asp.net To Select a value from the pop-up window in the
Article keywords: asp.net pop-up window value
In asp.net , it is a common way to pop the B page from page A and then close and update the data to a page after selecting the data in page B. It's just that I'm unfamiliar with JavaScript, so I worked on it all afternoon and finally got a little bit of success.
The test project has two pages: Default.aspx and Default2.aspx, on the Default.aspx page there is a TextBox1 and a button1,button1 used to trigger Default2.aspx,textbox1 to receive values from the child page.
The code for Button1 is as follows:
The following is a reference fragment: StringBuilder s = new StringBuilder (); S.append (""); Type Cstype = this. GetType (); ClientScriptManager cs = Page.clientscript; String sname = "LT"; if (!cs. IsStartupScriptRegistered (Cstype, sname)) Cs. RegisterStartupScript (Cstype, Sname, s.tostring ()); |
The Default2.aspx page has a CheckBoxList1 and a button1,button1 executes the value of returning the selected CheckBoxList1 and closes the current page.
The code is as follows:
The following is a reference fragment: protected void Button1_Click (object sender, EventArgs e) { StringBuilder s = new StringBuilder (); S.append (""); Type Cstype = this. GetType (); ClientScriptManager cs = Page.clientscript; String csname = "Ltype"; if (!cs. IsStartupScriptRegistered (Cstype, CSName)) Cs. RegisterStartupScript (Cstype, CSName, s.tostring ()); } private String Getselectvalue () { String rvalue = ""; for (int i = 0; I < this. CheckBoxList1.Items.Count; i++) { if (this. Checkboxlist1.items[i]. Selected) { if (rvalue = "") Rvalue = this. Checkboxlist1.items[i]. Text; Else Rvalue + = "," + this. Checkboxlist1.items[i]. Text; } } return rvalue; } |
It is important to execute the program at this time and not close it in the default2.aspx and not return the value:
In the head, join this line:
<base target= "_self"/>