我有一个页面 default.aspx ,其中有一个 datagrid 的超链接列, 其 URL 字符串值为 webform1.aspx?id={0},另一个页面 index.html 由 webform1.aspx 和 webform2.aspx 组成,我想在default.aspx 中点击 datagrid 的超链接列时能转到 index.html 页面,由其中的 webform1.aspx 的 page_load 接收 Request.QueryString["id"] 参数可以吗?怎么做呢? 如果不行的话我怎么才能把default.aspx 中的参数传到 webform1.aspx中去?
/// ShowModalDialog(for ie 5.0)
/// </summary>
/// <param name="paramType"></param>
/// <param name="docID"></param>
/// <param name="version"></param>
public static void ShowModalDialog(string modalPageId,System.Web.UI.Page oriPage,params string[] paramItem)
{
string strScript = "<script language=Javascript>";
strScript += "subWin = window.open('"+modalPageId; for(int i=0;i<paramItem.Length;i++)
{
if(i==0)
strScript += "?";
else
strScript += "&";
strScript += "param"+i.ToString()+"="+paramItem[i];
} strScript += "',null,'top=274,left=262,height=300,width=240,status=no,toolbar=yes,menubar=no,location=no')";
strScript += "</script>"; oriPage.RegisterStartupScript("subScript",strScript);
}
和html页面一样。。怎么把default.aspx中的参数传到webform1.aspx中去呢?
你上面的连接应该指向index.aspx。
datagrid 的超链接列, 其 URL 字符串值为 index.aspx?id={0}
然后在index.aspx.cs页面的Page_Load中接收这个id,
下面那样试试。
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
string id="";
id=Request.QueryString["id"].ToString();
Response.Write("<script language='javascript'>document.frames.frameName.src= webform1.aspx?id="+ id +"</script>");
}
private void Page_Load(object sender, System.EventArgs e)
{
string id="";
id=Request.QueryString["id"].ToString();
Response.Write("<frameset cols='200,*'><frame src='webform1.aspx?id=" + id + "'><frame src='webform2.aspx'></frameset>");
}
{
string id="";
id=Request.QueryString["id"].ToString();
Response.Write("<frameset cols='200,*'><frame src='webform1.aspx?id=" + id + "'><frame src='webform2.aspx'></frameset>");
}
像上面说的
private void Page_Load(object sender, System.EventArgs e)
{
string id="";
id=Request.QueryString["id"].ToString();
Response.Write("<frameset cols='200,*'><frame src='webform1.aspx?id=" + id + "'><frame src='webform2.aspx'></frameset>");
}
2.用session
现在我用的是session