从当前表单中调用另一个表单 [英] Calling another form from the current form

查看:79
本文介绍了从当前表单中调用另一个表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要从当前表单中调用另一个表单。



被叫表单应该填充有关的记录的详细信息。 致电表格并参考致电表格上的 personnel_id



我试过这个



Need to call another form from the current form.

The called form should be populated with the details of the records of the calling form with reference to the personnel_id on the calling form.

I tried this

protected void Page_Load(object sender, EventArgs e)
{
    this.Form.Target = "_blank";
}

protected void Button1_Click(object sender, EventArgs e)
{

    Response.Redirect("Otherpage.aspx");
}





我将 personnel_id 传递给调用表单,调用表单应填充调用表单表格包含数据库中的数据。





我如何做到这一点?



欢迎任何参考站点或示例。





非常感谢



我尝试过的事情:



审查了我的作品类似示例,浏览互联网。



I pass on the personnel_id to the calling form, which should populate the called form with data from the database.


How do I accomplish this?

Any reference sites or examples will be welcomed.


Thanks

What I have tried:

reviewed my on works for similar examples, browse the internet.

推荐答案

protected void Button1_Click(object sender, EventArgs e)
{
    int id = 123; // this will come from data on this page
    Session["PersonnelID"] = id;
    Response.Redirect("Otherpage.aspx");
}





in otherpage.aspx





in otherpage.aspx

protected void Page_Load(object sender, EventArgs e)
{
    int id = 0;
    if (Session["PersonnelID"] != null)
    {
        id = (int)Session["PersonnelID"];
        // you can also remove the data from the Session at this point if required
    }
}


加载方式!

查询字符串:Request.QueryString Collection [ ^ ]

Cookie:ASP.NET Cookies概述 [ ^ ]

会话变量: ASP.NET会话状态概述 [ ^ ]
Load of ways!
Query string: Request.QueryString Collection[^]
Cookies: ASP.NET Cookies Overview[^]
Session variables: ASP.NET Session State Overview[^]


这篇关于从当前表单中调用另一个表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆