Reputation: 147
I am using following code:
protected void gvDetails_RowCreated(object sender, GridViewRowEventArgs e)
{
e.Row.Attributes["ondblclick"] = "location.href='CustomerInfo.aspx?page=0&Custid=" + Convert.ToString(e.Row.FindControl("hdfCust_Id")) + "'";
}
so when I double click on the gridview it redirects me to next page and give error. The value of Custid it gives as follows:
Custid=System.Web.UI.WebControls.HiddenField
Upvotes: 0
Views: 45
Reputation: 17614
you need
((HiddenFiled)e.Row.FindControl("hdfCust_Id")).Value
Combining the above
e.Row.Attributes["ondblclick"] = "location.href='CustomerInfo.aspx?page=0&Custid="
+ ((HiddenField)e.Row.FindControl("hdfCust_Id")).Value + "'";
As Convert.ToString(e.Row.FindControl("hdfCust_Id"))
output will be System.Web.UI.WebControls.HiddenField
And ((HiddenField)e.Row.FindControl("hdfCust_Id")).Value
will be your required value
Upvotes: 3