在第二页上填充文本框,用户输入在1st上 [英] populate textbox on 2nd page with user input on 1st

查看:56
本文介绍了在第二页上填充文本框,用户输入在1st上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用visual web developer和sql express 2005设计了一个web应用程序。语言是VB。


我的默认页面只有一个表单,只有2个表单字段,提交时到我的default2页面,它有一个表单,我使用面板将其分解为部分。


在默认页面上,两个字段之一是邮政编码的文本框。在下一页(默认2)是注册页面,询问地址,它也有邮政编码。我不希望我的用户必须输入两次邮政编码,所以如何在第二页填写的默认页面上输入邮政编码?


我已经试过会话变量,跨页回发和查询字符串,但没有任何成功,并且没有完全理解填充文本框的部分,所以我没有线索。


任何帮助都将不胜感激。

I am desiging a web app using visual web developer and sql express 2005. Language is VB.

My default page has a form with only 2 form fields, which on submit goes to my default2 page, which has a form, where I am using panels to break it up into parts.

On the default page, one of the two fields is a textbox for zip code. On the very next page (default2) is a registration page, asking for address, and it has zip code as well. I do not want my users to have to enter the zip code twice, so how do I get the zip code entered on the default page populated on the 2nd page?

I''ve tried session variables, cross page postback, and query strings, but have had no succes with any and do not fully understand the part where it populates the textbox, so I''m out of clues.

Any help would be appreciated.

推荐答案

跨页回发是我的方式。


default1 .aspx

< asp:textbox ID =" Zip" RUNAT = QUOT;服务器" />

< asp:button runat =''server"一项PostBackUrl = QUOT; default2.aspx" />


default2.aspx

< asp:textbox ID =" Zip" RUNAT = QUOT;服务器" />


default2.aspx.cs

页面加载

Zip.Text = Request.Form [" Zip" ;]。ToString();


希望这会有所帮助

Cross page postback is the way I would do it.

default1.aspx
<asp:textbox ID="Zip" runat="server" />
<asp:button runat=''server" postbackurl="default2.aspx" />

default2.aspx
<asp:textbox ID="Zip" runat="server" />

default2.aspx.cs
in page load
Zip.Text = Request.Form["Zip"].ToString();


Hope this helps


我设计了一个使用visual web developer和sql express 2005的web应用程序。语言是VB。


我的默认页面只有一个表单,只有2个表单字段,提交到我的default2页面,其中有一个表单,我使用面板将其分成几部分。


在默认页面上,两个字段中的一个是邮政编码的文本框。在下一页(默认2)是注册页面,询问地址,它也有邮政编码。我不希望我的用户必须输入两次邮政编码,所以如何在第二页填写的默认页面上输入邮政编码?


我已经试过会话变量,跨页回发和查询字符串,但没有任何成功,并且没有完全理解填充文本框的部分,所以我没有线索。


任何帮助将不胜感激。
I am desiging a web app using visual web developer and sql express 2005. Language is VB.

My default page has a form with only 2 form fields, which on submit goes to my default2 page, which has a form, where I am using panels to break it up into parts.

On the default page, one of the two fields is a textbox for zip code. On the very next page (default2) is a registration page, asking for address, and it has zip code as well. I do not want my users to have to enter the zip code twice, so how do I get the zip code entered on the default page populated on the 2nd page?

I''ve tried session variables, cross page postback, and query strings, but have had no succes with any and do not fully understand the part where it populates the textbox, so I''m out of clues.

Any help would be appreciated.


谢谢你的帮助。


输入时:


Sub Page_Load(ByVal sender As Object,ByVal e As EventArgs)


PostalCode.Text = Request.Form [" PostalCode"]。ToString()


End Sub


" Request.Form"带下划线,它给出的信息是不能转换为字符串。


如果我将邮政编码的括号更改为括号(不要问为什么我这样做),例如:PostalCode.Text = Request.Form(" PostalCode)。ToString(),先前的错误消失,但是一个新的错误,其中对象引用未设置为对象的实例。


另外,如果我在行尾添加分号,就像在你的例子中一样,它表示字符无效。


这就像我开始工作一样接近,所以我很感谢你的帮助。
Thankyou for you help.

When I type:

Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

PostalCode.Text = Request.Form["PostalCode"].ToString()

End Sub

"Request.Form" is underlined and the message it give is "cannot be converted to string."

And, if I change the brackets around postalcode to parentheses (dont ask why I did that), such as: "PostalCode.Text = Request.Form("PostalCode").ToString(), the previous error goes away, but a new error which says "Object reference not set to an instance of an object."

Also, if I put a semicolon at the end of the line, like in your example, it says "character not valid."

This is as close as I''ve come to getting this thing work, so I''m thankful for your help.


哦,cs是什么?在default2.aspx.cs中代表C#?因为我使用Visual Basic。
Oh, does the "cs" in default2.aspx.cs stand for C#? Because I as using Visual Basic.


这篇关于在第二页上填充文本框,用户输入在1st上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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