Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to refer to data in BoundField in GridView
Message
From
04/01/2011 15:44:30
 
 
To
04/01/2011 15:21:48
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01494623
Message ID:
01494660
Views:
28
>>Hi,
>>
>>I have a gridview with this column defined:
>>
>>
<asp:BoundField DataField="AgentPK" HeaderText="AgentPK" Visible="False" />
>>
>>When looping through the rows in the grid I want to check what value this column has. How do I refer to it?
>>
>>If I define another column like this:
>>
>>
<ItemTemplate>
>>     <mm:mmCheckBox ID="chkSelector" runat="server" Text="" />
>></ItemTemplate>
>>
>>Then I can refer to it like this:
>>
>>
CheckBox cb = (CheckBox)(row.FindControl("chkSelector"))
>>
>>Do I need to use an ItemTemplate in order to get the value of my AgentPK field?
>
>Frank,
>
>You can probably set the DataKey property of the grid to be that column and then you can access it by getting the Grids SelectedValue. Here is a link that describes it. http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.selectedvalue.aspx
>
>Tim

Thanks Tim,

I use the data key for another value already. I've got around the problem by using a Template field.
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Previous
Reply
Map
View

Click here to load this message in the networking platform