When we use template field columns with buttons in gridview, we may need to access the row number to find the datakeys in the button click event. And here is the code how it looks like..
protected void lnkBtnCheckIn_Click(object sender, EventArgs e)
{
LinkButton lnkButton = sender as LinkButton;
GridViewRow row = lnkButton.Parent.Parent as GridViewRow;
int fleetMovemetId = 0;
int.TryParse(Gridview1.DataKeys[row.RowIndex].Values[1].ToString(), out fleetMovemetId);
}
Njoy..
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment