简体   繁体   English

将表单操作从aspx页更改为其后面的母版页

[英]change form action from aspx page to master page behind it

i have a master page and a child aspx page, coneected to each other. 我有一个母版页和一个子aspx页,彼此相连。 the master page has the form in it. 母版页中包含表单。 Now the child page has checkboxes, whose value i would like to pass to another child page with same master page behind it. 现在,子页面具有复选框,我希望将其值传递到后面具有相同母版页的另一个子页面。 Can i change the action=abc.aspx and method=post? 我可以更改action = abc.aspx和method = post吗? How can i send all the checkbox values (checkbox.text = abc@oke.com) to the next page? 如何将所有复选框的值(checkbox.text = abc@oke.com)发送到下一页? there are lots of these values that need to pass to nex tpage. 这些值中有很多需要传递给net tpage。

Use Button.PostBackUrl to change the page which the button posts to, and then on the target page, use Page.PreviousPage to get a reference to the source page (and therefore its controls). 使用Button.PostBackUrl更改按钮发布到的页面,然后在目标页面上使用Page.PreviousPage获取对源页面(及其控件)的引用。

By default you can use Page.PreviousPage.FindControl(...) to find a control on the source page by ID, then cast it to a checkbox and retrieve its values. 默认情况下,您可以使用Page.PreviousPage.FindControl(...)通过ID在源页面上查找控件,然后将其Page.PreviousPage.FindControl(...)转换为复选框并检索其值。 You can also specify the type of the previous page with a <%@ PreviousPageType %> directive, and then access the previous page's public properties. 您还可以使用<%@ PreviousPageType %>指令指定<%@ PreviousPageType %>的类型,然后访问上一页的公共属性。

See Cross-Page Posting for details. 有关详细信息,请参见跨页发布

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM