gridview

GridView 中DataKeyNames,DataKeys

亡梦爱人 提交于 2019-12-21 11:19:00
1.DataKeyNames 属性指定表示数据源主键的字段。 当设置了 DataKeyNames 属性时,GridView 控件用来自指定字段的值(数据库中表的值)填充它的 DataKeys 集合,这提供了一种访问每个行的主键的便捷方法。(因为表中的ID列一般不显示给网页上,如对表中的列更新时,就需要ID列了) DataKeyNames就是数据库表的字段,可以设置多个。注意 若要以声明方式设置此属性,请使用以逗号分隔的字段名列表。 设置DataKeyNames属性,它保存了指定数据库中的想要获取值的列名,该属性会自动填充到GridView控件的DataKeys集合, 例如: 事件: protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { //通过DataKeyNames属性里设置的字段名获得了数据库表中的ID值 int id =int.Parse( this.GridView1.DataKeys[e.RowIndex][0].ToString()); //获得GridView中被更改的单元格中的值 string a1 = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[0].Controls[0]).Text.ToString()

GridView显示图片

本秂侑毒 提交于 2019-12-21 11:18:49
参考文章: http://www.cnblogs.com/jll/archive/2005/12/14/297153.html 以下内容出处忘了 = =! 在ASP.NET中经常需要使用GridView的一列来显示图片,下面是在实践中使用到的方法: 第一种: 添加ImageField列,然后设置DataImageUrlField和DataImageUrlFormatString显示,以下是实现方式 <asp:ImageField DataImageUrlField="CHM_RowID" DataImageUrlFormatString="CQU_CHM_ShowImage.aspx?chm_rowid={0}" HeaderText="图片"> </asp:ImageField> 第二种: 增加模板列,此方法 可以控制图片大小 : <asp:TemplateField HeaderText="图片预览"><ItemTemplate>   <img src='CQU_CHM_ShowImage.aspx?chm_rowid=<%# Eval("CHM_RowID") %>' width="150px" height="100px" /> </ItemTemplate></asp:TemplateField> 显示图片的页的代码: CQU_CHM_ShowImage.aspx.cs:

在GridView中显示图片

大兔子大兔子 提交于 2019-12-21 11:18:02
文章出处 :http://moosdau.cnblogs.com 作者:木只八刀 在GridView中显示图片 这里讨论的是, 增加一个图片列, 这样每一行记录都会附带一个小图片. 如下图所示: 第一列是一个小图示, 第二列显示数据, 这样比单纯显示数据要漂亮许多. 在GridView 里显示图片, 大抵有两种办法: <1>添加 ImageField , 绑定到数据源的某一列. <2>编辑模板, 添加一个带Image 的列. 以下详述两种方法: <1>添加一个gridview 到页面, 点选它的任务菜单"编辑列", 在弹出的编辑框中, 选择ImageField 并点击添加, 然后选中刚刚添加的列, 右侧面板会显示出它的属性, 在DataImageUrlField 属性中, 填入数据表中的列名. 代码: < asp:GridView ID ="GridView1" runat ="server" > < Columns > < asp:ImageField DataImageUrlField ="img" > </ asp:ImageField > </ Columns > </ asp:GridView > 然后编辑后台代码: DataTable dt = new DataTable(); DataColumn dc = new DataColumn(); dt.Columns

Devexpress GridControl

爷,独闯天下 提交于 2019-12-21 11:01:57
1、隐藏“Drag a column header here to group by that column”如下: 选择gridview->属性 选择OptionView->ShowGroupPanel->false 2、关于gridcontrol显示标题(Caption): 选择gridcontrol——》run designer 新建列 Column Caption用来显示标题,ColumnEdit 选择显示控件的类型 ,FileName 需要绑定现实的字段(类的属性或者数据库列名) 3、gridControl 分组显示 (例如按照translator分组) 1 gridView3.Columns["translator"].GroupIndex = 0; 2 gridView3.ExpandAllGroups(); 3 gridView3.GroupSummary.Add(SummaryItemType.None, "translator", null); 4、gridview 显示行号 1 private void gridView1_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e) 2 { 3 if (e.Info

DevExpress 操作gridcontrol

混江龙づ霸主 提交于 2019-12-21 11:00:05
XtraGrid的关键类就是:GridControl和GridView。GridControl本身不显示数据,数据都是显示在GridView/CardView/XXXXView中。GridControl是各种View的容器。所以要控制显示,要从GridView这些类入手。 1.DevExpress控件组中的GridControl控件不能使横向滚动条有效。现象:控件中的好多列都挤在一起,列宽都变的很小,根本无法正常浏览控件单元格中的内容。 解决:gridView1.OptionsView.ColumnAutoWidth属性是true,即各列的宽度自动调整,你把它设成false,就会出现了。 2.使单元格不可编辑。 gridcontrol -->gridview -->OptionsBehavior -->Editable=false 3.去除"Drag a Column Header Here To Group by that Column" 属性Gridview->Option View->Show Group Panel=false,就好了 4.数据绑定 (1) 在GridControl控件面板中点击 (2) 在出现的窗体中,点击左边的 进行列名的编辑。点击上方的 可添加一列, 插入一列, 移除一列。点击

How to create customized grid view with two textview

 ̄綄美尐妖づ 提交于 2019-12-21 06:57:21
问题 How can i customize a cell of Grid view with two textview, as i want to show 2 labels in each cell. In my task, i am looking for the Grid View as a Table and it contains two various Values in each cell. i have Tried the Customized Grid view for this as follow. <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <Button android:id="@+id/selectBtn" android:layout

Append a child to a grid, set it's row and column

左心房为你撑大大i 提交于 2019-12-21 06:52:21
问题 How can I append an Image object into a Grid and set it's Row and Column ? The grid is 3x3. Main file: <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="440" Width="400" ResizeMode="NoResize"> <Window.Background> <ImageBrush ImageSource="C:\Users\GuyD\AppData\Local\Temporary Projects\WpfApplication1\AppResources\Background.png"></ImageBrush> </Window

using radiobuttons in a gridview control

巧了我就是萌 提交于 2019-12-21 06:37:27
问题 I have a gridview control in which the data is dispalyed using a stored procedure. the grid has three columns, first one contains radiobuttons. the general idea is that the user should be able to select only one radiobutton from (in my case) 5 radiobuttons. The problem in the present functionality is that i can select all the radiobuttons at the same time. I tried group the radiobuttons using 'groupname' property..it didn't work. How can i fix it? Here is the gridview control <asp:GridView

Yii2 display multiple images in gridview row

扶醉桌前 提交于 2019-12-21 06:37:13
问题 I want to display multiple images in a gridviews single row. For example: I have table A, Table B and table C. Table A has my_id. In Table B my_id is the foreign key. Along with my_id it has c_id. Table C has c_id which is in reference in Table B. Table C also has a filepath to display images. in Table A i have my_id as follows: 1, 2, 3, 4, 5, 6. In Table B i have my_id as follows. 1 ,1 ,1 ,2 ,3, 3. In Table B i also have c_id as follows. 1, 2, 3, 4, 5, 6. In table C my c_id's are: 1, 2, 3, 4

android gridview header solution with adapter recycling cells

限于喜欢 提交于 2019-12-21 05:57:23
问题 I've seen many solutions about how to implement a gridview header that scrolls along with the rest of the grid. Most of them consist in creating a listlayout or relativelayout with a header view and a gridview all inside a scrollview. This solution has the problem that the scrollview doesn't know the size of the grid so to overcome that you need to extend grid view like here: https://stackoverflow.com/a/4536955/751180 But the problem is that but doing so you are forcing the gridview to render