Because I don't know how to call aspx in the script of aspx. function in cs, unable to operate the GridView control, unable to read control dataset information; Because aspx is unknown. how does the cs function call the function in the script in aspx? <div> and other attributes cannot be set. Through intercommunication, you can easily solve these two problems.
The script function at the front end of aspx calls the background function in aspx. cs:
Aspx:
<Script type = "text/javascript">
Function FrontFunction ()
{
Var RetStr = <% = BehindtFunction () %>;
Alert (RetStr );
// Window. returnValue = RetStr;
// Window. close ();
// Alert ("000 ");
}
</Script>
Aspx. cs:
Protected string BehindtFunction (object sender, EventArgs e)
{
// Code
Return "null"; // a return value is required.
}
In aspx. cs, the background function calls the script Function of the aspx Foreground:
Aspx. cs:
Protected string BehindtFunction (object sender, EventArgs e)
{
// Code
ClientScript. RegisterStartupScript (this. GetType (), "clear", "<script> FrontFunction () </script> ");
}
Aspx:
<Script type = "text/javascript">
Function FrontFunction ()
{
Mask. style. visibility = 'visable ';
Div2.style. visibility = 'visable ';
Return false;
}
</Script>
<Div id = "mask"> </div>