从当前表单中调用另一个表单

编程入门 行业动态 更新时间:2024-10-10 17:31:02
本文介绍了从当前表单中调用另一个表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

需要从当前表单中调用另一个表单。 被叫表单应该填充有关的记录的详细信息。 致电表格并参考致电表格上的 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[^]

更多推荐

从当前表单中调用另一个表单

本文发布于:2023-11-02 10:00:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1552080.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表单

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!