Rajkumar R

Rajkumar R

  • NA
  • 183
  • 220k

How to post value from gridview

Nov 29 2011 5:03 AM
I have a grid view like this
create, Edit,Print, ID, Name, HBL_NO, AMount
here i want to get the selected row value of HBL_NO
here create , Edit and print are image button and item template field,
when i click create button i want the HBL_NO to the corresponding row
i have tried like this , but i m getting error in that
<b>string s = gvBSV.SelectedRow.Cells[4].Text;
Response.Redirect("Delivery_Order.aspx?BL_Code=" + ((ImageButton)sender).CommandName + "&Purpose=N&Menu_ID=" + hndMenu_ID.Value +"&HBL_NO="+s.ToString());</b>
here the s contain the HBL_NO
but i m getting error
ie,.

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 422: {
Line 423: //Response.Redirect("Delivery_Order.aspx?BL_Code=" + ((ImageButton)sender).CommandName + "&Purpose=N&Menu_ID=" + hndMenu_ID.Value + "&BL_Type=" + ViewState["BL_Type"].ToString());
Line 424: string s = gvBSV.SelectedRow.Cells[4].Text;
Line 425: //Session["HBL"] = gvBSV.SelectedRow.Cells[4].Text;
Line 426: Response.Redirect("Delivery_Order.aspx?BL_Code=" + ((ImageButton)sender).CommandName + "&Purpose=N&Menu_ID=" + hndMenu_ID.Value +"&HBL_NO=");