在我的应用程序中,我需要将id从一个页面传递到另一个页面,我尝试使用session但它给我id为null,任何人都可以提供其他方法来执行此操作
GridDataItem item = (GridDataItem)e.Item;
string ticketid = item["ID"].Text;
Session["viewID"] = ticketid;
Response.Redirect("View.aspx");
答案 0 :(得分:1)
// you check if the item["ID"] is null?
string ticketid = item["ID"].Text;
// are you making sure you are not overiding this session variable some place on the page
Session["viewID"] = ticketid;
// this should get the id on the query string if you don't want to use session.
Response.Redirect(String.Format("View.aspx?ViewID={0}", ticketid));