0
时使用Request.QueryString传递一个值我有一个gridview,我想将行单元格中的值传递给另一个页面。根据字符串的值,我可以运行一个特定的查询并填充另一个gridview。 我的问题是,当我双击该行时,它不会拾取该值,但是,当我更改行单元格索引时,它将用于行中的其他列。 让我知道是否需要更多信息,谢谢。当我双击
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>
的价值应该得到基于该会话,然后用来确定使用哪种方法来填充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();
无论如何,用'开关((字符串)会议[ “selectedLactationEvent”])的情况下“MMR”:{} ...' – abatishchev 2012-07-25 11:39:40
ASP.Net页面无法捕获双击事件。你将不得不在JavaScript中通过调用你的代码从客户端 – Ahmad 2012-07-25 11:40:00
我在JavaScript中这样做 – 2012-07-25 16:18:45