开发者

pass data from parent to popup

开发者 https://www.devze.com 2022-12-27 14:37 出处:网络
Apologies if this seems like a duplicate post... Thomas Warner kindly answeres an earlier post suggesting I use:

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 abov开发者_开发知识库e, all that appears in the popup is the actual text 'textbox1.text' rather than what is actualy in that control.

thanks again


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号