Retrieve GridView string value

tsuNami

New Member
I have a GridView -\[code\]<asp:GridView ID="table_example" Runat="server" DataSourceID="SqlDataSource3" AutoGenerateColumns="False" ClientIDMode="Static" onprerender="table_example_PreRender"> <Columns> <asp:TemplateField> <HeaderTemplate> <asp:Label ID="Label1" runat="server" Text="Select"></asp:Label> </HeaderTemplate> <ItemTemplate> <asp:CheckBox ID="chkRow" runat="server" OnCheckedChanged="CheckBoxPN_CheckedChanged" AutoPostBack="true"/> </ItemTemplate> </asp:TemplateField> <asp:BoundField HeaderText="profileID" DataField="profileID" SortExpression="profileID"></asp:BoundField> <asp:BoundField HeaderText="profileName" DataField="profileName" SortExpression="profileName"></asp:BoundField> </Columns></asp:GridView>\[/code\]Where the code behind for \[code\]chkRow\[/code\]-\[code\]protected void CheckBoxPN_CheckedChanged(Object sender, EventArgs e) { CheckBox chk = (CheckBox)sender; GridViewRow row = (GridViewRow)chk.NamingContainer; //when a user clicks the checkbox I need the string from profileName in that row. }\[/code\]On debugging I can get to the checkBox changed event, however need to retrieve the string from the \[code\]profileName\[/code\] cell from its respective row cell.I tried something like this -\[code\]string c = row.Cells("profileName").value.toString();\[/code\]However this did not work, how can I get the string?
 
Back
Top