retrive gridview cell value
C#
2
Posts
2
Posters
0
Views
1
Watching
-
Hi All, I need to retrive value of GridView slelected row cell value.
If I click on button1 or Button2 I want to retrive value of a specefic cell value thanks,
Add a
CommandName
property to your buttons like this.<asp:Button ID="Button1" runat="server" CausesValidation="false" Text="Edit" OnClick="Button1_Click" CommandName="Button1Command"/>
And then handle the
RowCommand
event. See belowprotected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Button1Command")
{
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = GridView1.Rows[index];
//From there, you can get the value of the cells from the row.
}
}Signature construction in progress. Sorry for the inconvenience.