I have a gridview and I want to pass a value from a row cell to another page. Based on the value which is a string, I can run a specific query and fill another gridview. My problem is, that when I double click the row, it won't pick up the value, however, it will for the other columns in the row when I change the row cell index. Let me know if more info is needed, thanks.
protected void grdCowCard_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string querystring = string.Empty;
string id = e.Row.Cells[1].Text;
//Session["selectedLactationEvent"] = "MMR";
e.Row.Attributes["ondblclick"] = string.Format("doubleClick({0})", id);
//won't pick up the value("MMR") at Row.Cells[1]
//but will pick up the value("1") at Row.Cells[0]
}
}
<script type="text/javascript">
function doubleClick(queryString) {
window.location = ('<%=ResolveUrl("LactationDetails.aspx?b=") %>' + queryString);
}
</script>
The value should get based to this session and then used to determine which method to use to fill the gridview.
Session["selectedLactationEvent"] = Request.QueryString["b"].ToString();
//string test = (string)(Session["selectedLactationEvent"]);
if ((string)(Session["selectedLactationEvent"]) == "MMR")
GetExtraMMRdetails();
else if ((string)(Session["selectedLactationEvent"]) == "LAC")
GetExtraLACdetails();
else
GetExtraEBIdetails();