To pop the custom dialog box in the Web.

Source: Internet
Author: User
Tags visual studio
Main Web pages:
private void Page_Load (object sender, System.EventArgs e)
{
String strscript= "<script language=\" javascript\ ">\n"
Returns-------------------------------------------------a single value
Strscript + = "function GetValue (infoa,infob) {\ n";
Strscript + = "var Strid=window.showmodaldialog" (' Popforms/testpop.aspx? Parama= ' +infoa+ ' &paramb= ' +infob,null, ';
Strscript = "' Dialogwidth:450px;dialogheight:480px;center:1;scroll:1;help:0;status:0;resizable:no; ') \ n ";
Strscript + = "if (strid!=undefined) \ document.all['" + Txttext.clientid + "'].value=strid;\n"; The result Strid the value to TxtText
Strscript + = "}\n"; If you return the numbers,
------------------------------------------------Multi-value return
Sbscript.append ("function openeditlot () {\ n");
Sbscript.append ("var strid=window.showmodaldialog" (' Popforms/test.aspx?mytime= ' +date (), NULL, ");
Sbscript.append ("' Dialogwidth:433px;dialogheight:450px;center:1;scroll:1;help:0;status:0;resizable:no; ') \ n ");
Sbscript.append ("if (strid!=undefined) {document.all['" + Txta.clientid + "'].value=strid[0]\n");
Sbscript.append ("document.all['" + Txtb.clientid + "'].value=strid[1]\n");
Sbscript.append ("document.all['" + Txtc.clientid + "'].value=strid[2]\n}");
Sbscript.append ("}\n");
More and here ....
//-------------------------------------------------
Strscript = "</script>";
This. Page.registerclientscriptblock ("ClientScript", strscript);

if (! IsPostBack)
{
btntest.attributes["onclick"] = "GetValue" (document.all (' "+txta.clientid+"). Checked,document.all (' "+
Txtb.clientid+ "'). Value)";
}
}
Bounce out of Web pages:
The definition of the return function in 1.HTML for adjusting the return function in the page
<HEAD>
<title>QueryLot</title>
<meta name= "generator" content= "Microsoft Visual Studio 7.0" >
<meta name= "Code_language" content= "C #" >
<meta name= "vs_defaultClientScript" content= "JavaScript" >
<meta name= "vs_targetschema" content= "http://schemas.microsoft.com/intellisense/ie5" >
<link href= ". /.. /webcontroler/icmes.css "type=" Text/css "rel=" stylesheet ">
<base target= "_self" >

<script language= "JavaScript" >
Function ReturnValue (PAMA,PAMB,PAMC)
{
var my_array = new Array (PamA, PAMB,PAMC);
Window.returnvalue = My_array;
Window.close ();
}

</script>
</HEAD>
2. Adjust the return function in the page
Use the push button to return
private void Page_Load (object sender, System.EventArgs e)
{
if (! IsPostBack)
{
btnreturn.attributes["onclick"] = "returnvalue" (' +valuea+ ", '" +valueb+ ", '" +valuec+ ")";
}
}

Use the DataGrid Click to return
private void Dbgrid_itemdatabound (object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if (E.item.datasetindex!=-1)
{
E.item.cells[0]. attributes["onclick"] = "returnvalue" (' +e.item.cells[0]. text+ "', '" "+e.item.cells[1]. text+ "', '" +
E.ITEM.CELLS[2]. text+ "')";
E.item.cells[0]. CssClass = "";//referencing a CSS file for point-click
}
}
3. Return with no return value
private void Btncancel_click (object sender, System.EventArgs e)
{
Response.Write ("<script language=javascript> window.close (); </Script> ");
}




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.