在网格视图中使用有界字段 [英] Using Bounded field in Grid View
本文介绍了在网格视图中使用有界字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我不喜欢使用网格视图.我正在使用此代码在页面中显示数据.但是
我想在页面中使用此网格的绑定字段插入列.我应该添加或更改所有内容.帮助我...
Hi am new to using grid view.I am using this code for displaying data in my page.But
I want to insert the columns using bound fields for this grid in my page. what are all should i add or change. help me with this ...
<pre lang="xml"><asp:GridView ID="gridRegistrationTableDetails" runat="server"
OnRowEditing="EditRecord "
OnRowCancelEdit="CancelRecord "
OnRowUpdating="UpdateRecord"
OnRowDeleting="DeleteRecord "
onselectedindexchanged="gridRegistrationTableDetails_SelectedIndexChanged"
BackColor="White" BorderColor="#336666" BorderStyle="Double" BorderWidth="3px"
CellPadding="4" GridLines="Horizontal" onrowcancelingedit="CancelRecord">
<Columns>
<asp:CommandField CausesValidation="False" EditText="Alter" InsertVisible="False"
ShowCancelButton="False" />
<asp:CommandField ShowDeleteButton="True" />
<asp:ButtonField CommandName="Select" Text="Edit" />
</Columns>
<FooterStyle BackColor="White" ForeColor="#333333" />
<HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="White" ForeColor="#333333" />
<SelectedRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F7F7F7" />
<SortedAscendingHeaderStyle BackColor="#487575" />
<SortedDescendingCellStyle BackColor="#E5E5E5" />
<SortedDescendingHeaderStyle BackColor="#275353" />
</asp:GridView>
推荐答案
只需在<Columns>
标签内添加BoundField列即可.
示例:
Just add the BoundField column inside the<Columns>
tag.
Example:
<columns>
<asp:boundfield datafield="CustomerID" readonly="true" headertext="Customer ID"/>
</columns>
参考: MSDN:BoundField [如何在GridView中创建自定义绑定字段 [ ^ ]
Refer: MSDN: BoundField[^]
Also go through this: How to create custom bound fields in GridView[^]
这篇关于在网格视图中使用有界字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文