Asp.net is a beginner who has learned how to simulate the dialog box effect,
There is a textbox and a button on the home page. click the button to bring up a modal display page.
, Enter the text, click OK to return to the home page, and return the text value.
It's very simple.
Home page:
@? Page? Language = "C #"? %>
Script? Runat = "server">
???? Private? Void? Page_load (object? Sender ,? System. eventargs? E)
???? {
???????? If? (! Ispostback)
????????? Btnopen. Attributes. Add ("onclick ",? @ "Var? Strreturn ;? Strreturn = Window. showmodaldialog ('dialogform. aspx ', null, 'status: No; dialogwidth: 250px; dialogheight: 125px; dialoghide: true; help: No; scroll: no'); If? (Strreturn ?! =? Null )? Document. getelementbyid ('txtvalue'). value = strreturn ;");
????}
SCRIPT>
Body? Ms_positioning = "gridlayout">
?? Form? Id = "form1 "? Method = "Post "? Runat = "server">
???? ASP: textbox? Id = "txtvalue "? Style = "Z-INDEX :? 101 ;? Left :? 16px ;? Position :? Absolute ;? Top :? 24px "? Runat = "server"> Asp: textbox>
???? ASP: button? Id = "btnopen "? Style = "Z-INDEX :? 102 ;? Left :? 176px ;? Position :? Absolute ;? Top :? 24px "? Runat = "server "? TEXT = "open"> Asp: button>
?? Form>
Body>
Dialog Box:
@? Page? Language = "C #"? %>
Script? Runat = "server">
???? Private? Void? Page_load (? Object? Sender ,? System. eventargs? E)
???? {
????????? If? (?! Ispostback ?)
????????? {
????????????? Btnok. Attributes. Add ("onclick ",? @ "Window. returnvalue? =? Document. getelementbyid ('txtvalue'). value ;? Window. Close ();");
????????????? Btncancel. Attributes. Add ("onclick ",? @ "Window. Close ();");
?????????}
????}
SCRIPT>
Body? Ms_positioning = "gridlayout">
?? Form? Id = "form1 "? Method = "Post "? Runat = "server">
???? ASP: textbox? Id = "txtvalue "? Style = "Z-INDEX :? 101 ;? Left :? 16px ;? Position :? Absolute ;? Top :? 24px "? Runat = "server"> Asp: textbox>
???? ASP: button? Id = "btnok "? Style = "Z-INDEX :? 103 ;? Left :? 48px ;? Position :? Absolute ;? Top :? 56px "? Runat = "server "? TEXT = "OK "? Width = "56px"> Asp: button>
???? ASP: button? Id = "btncancel "? Style = "Z-INDEX :? 102 ;? Left :? Pixel PX ;? Position :? Absolute ;? Top :? 56px "? Runat = "server "? TEXT = "cancel"> Asp: button>
?? Form>
Body>