1. Opening the modal window
2. Close the modal window
3. Transmission Parameters of the modal window.
4. Others ....
1. window. showModalDialog ("DialogPage. aspx "," newwin "," dialogHeight: 200px; dialogWidth: 150px; dialogTop: 458px; dialogLeft: 166px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes ;");
2. window. close ();
3. Pass the value
ParentPage. aspx:
Window. showModalDialog ("DialogPage. aspx? Para1 = aaa & para2 = bbb ");
DialogPage. aspx:
String str1 = Request. QueryString ["para1"]. toString ();
String str2 = Request. QueryString ["para2"]. toString ();
Return Value
DialogPage. aspx:
Window. returnValue = "aaa ";
ParentPage. aspx:
Var str = window. showModalDialog ("DialogPage. aspx ");
4.
Why does the aspx page reopen a page when showmodeldialog is submitted?
On the showmodaldialog page, add a line between
5. In the data binding mode form, you can also create a template column in The DataGrid, add the Html button, and add the following to the button:
OnClick = "returnValue = '<% # DataBind. Eval (Container. DataItem," Name ") %>'; window. close ()"
You can pass the related values of the selected row of the DataGrid in the mode dialog box.
6. Example
WebForm2.aspx. vb
Inherits System. Web. UI. Page
Protected WithEvents Button1 As System. Web. UI. WebControls. Button
Protected WithEvents TextBox1 As System. Web. UI. WebControls. TextBox
Protected WithEvents Button2 As System. Web. UI. WebControls. Button
Protected WithEvents TextBox2 As System. Web. UI. WebControls. TextBox
Private Sub Page_Load (ByVal sender As System. Object, ByVal e As System. EventArgs) Handles MyBase. Load
Button1.Attributes. Add ("onclick", "var st = window. showModalDialog ('user. aspx? Val = '+ document. all ('textbox1'). value); document. all ('textbox1'). value = st; return st ;")
End Sub
Private Sub Button2_Click (ByVal sender As System. Object, ByVal e As System. EventArgs) Handles Button2.Click
RegisterStartupScript ("key", "<script> window. opener = null; window. close (this); </script> ")
End Sub
User. aspx. vb
Protected WithEvents TextBox1 As System. Web. UI. WebControls. TextBox
Protected WithEvents cancel As System. Web. UI. WebControls. Button
Protected WithEvents OK As System. Web. UI. WebControls. Button
Protected WithEvents TextBox2 As System. Web. UI. WebControls. TextBox
Private Sub Page_Load (ByVal sender As System. Object, ByVal e As System. EventArgs) Handles MyBase. Load
Dim str As String
If Not IsPostBack Then
Str = Request. QueryString ("val ")
TextBox1.Text = str
End If
End Sub
Private Sub cancel_Click (ByVal sender As System. Object, ByVal e As System. EventArgs) Handles cancel. Click
RegisterStartupScript ("key", "<script> window. returnValue = 'null'; window. opener = null; window. close (this); </script> ")
End Sub
Private Sub OK _Click (ByVal sender As Object, ByVal e As System. EventArgs) Handles OK. Click
RegisterStartupScript ("key", "<script> window. returnValue = document. all ('textbox2 '). value; window. opener = null; window. close (this); </script> ")
End Sub