I've a gridview with selected columns and rows. The row consists of Textbox for every column in a row. I need to select a row in order to get the current rowindex which I've done using below code.
protected void gvtotqty_onrowdatabound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(gvtotqty, "Select$" + e.Row.RowIndex);
e.Row.ToolTip = "Click to select this row.";
}
}
protected void gvtotqty_onselectedindexchanged(object sender, EventArgs e)
{
foreach (GridViewRow row in gvtotqty.Rows)
{
if (row.RowIndex == gvtotqty.SelectedIndex)
{
Session["rowindex"]=row.RowIndex;
row.BackColor = ColorTranslator.FromHtml("#A1DCF2");
row.ToolTip = string.Empty;
}
else
{
row.BackColor = ColorTranslator.FromHtml("#FFFFFF");
row.ToolTip = "Click to select this row.";
}
}
}
Everything is working fine where I get my rowindex when debugged but I am not able to type anything in Textbox as it is getting refreshed. I know that
Page.ClientScript.GetPostBackClientHyperlink
calls PostBackEvent. By using this method, how can I type the values in Textboxes?