将数据从父级传递到弹出窗口

发布于 2024-08-30 00:41:19 字数 315 浏览 0 评论 0原文

如果这看起来像重复的帖子,我深表歉意...

托马斯·华纳(Thomas Warner)善意地回答了之前的帖子,建议我使用:

Popup.aspx?Data1=Piece_of_data&Data2=Piece_of_data

只是想问,如果我的代码是 Popup.aspx?Data1=textbox1。 text&Data2=textbox2.text

引用文本框中内容的正确方法是什么?

方法如上,弹出窗口中出现的只是实际文本“textbox1.text” 而不是该控件中实际存在的内容。

再次感谢

Apologies if this seems like a duplicate post...

Thomas Warner kindly answeres an earlier post suggesting I use:

Popup.aspx?Data1=Piece_of_data&Data2=Piece_of_data

Just want to ask, if my code is Popup.aspx?Data1=textbox1.text&Data2=textbox2.text

whats the proper way to reference whats in the textboxes?

The way is is above, all that appears in the popup is the actual text 'textbox1.text'
rather than what is actualy in that control.

thanks again

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

悲歌长辞 2024-09-06 00:41:19

使用 asp.net,您可以将值直接写入字符串,如下所示:

Popup.aspx?Data1=<%=textbox1.Text%>&Data2=<%=textbox1.Text%>

更理想的方法是在代码隐藏中构建 URL 字符串,以免弄乱您的 HTML 和 C# 代码。

这样您就可以执行以下操作:

String popupUrl = String.Format("Popup.aspx?Data1={0}&Data2={1}",
textbox1.Text,textbox2.Text);

这还允许您在开始传递这些值之前对文本框中的值进行任何清理检查。

Using asp.net you can litterally write the value straight into the string like:

Popup.aspx?Data1=<%=textbox1.Text%>&Data2=<%=textbox1.Text%>

A more ideal way of doing this would be to build up the URL string in your codebehind so as not to clutter up your HTML and C# code.

That way you could do something like:

String popupUrl = String.Format("Popup.aspx?Data1={0}&Data2={1}",
textbox1.Text,textbox2.Text);

This will also allow you to do any sanitization checks on the values from the textboxes before you start passing those values around.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文