Whole
Program Of
Code As follows:
Copy code The Code is as follows: using system;
Using system. Collections. Generic;
Using system. text;
Using system. Web;
Using system. Web. UI;
/// <Summary>
/// A small JavaScript window is displayed.
/// </Summary>
/// <Param name = "JS"> window Information </param>
Public static void alert (string message, page)
{
# Region
String JS = @ "<script language = 'javascript '>
Alert ('"+ message +"'); </SCRIPT> ";
// Httpcontext. Current. response. Write (JS );
If (! Page. clientscript. isstartupscriptregistered (page. GetType (), "alert "))
{
Page. clientscript. registerstartupscript (page. GetType (), "alert", JS );
}
# Endregion
}
///
// the message box is displayed and redirected to a new URL.
///
/// message content
// connection address
Public static void alertandredirect (string message, string tourl, page)
{< br> # region
string JS = " ";
// httpcontext. current. response. write (string. format (JS, Message, tourl);
If (! Page. clientscript. isstartupscriptregistered (page. getType (), "alertandredirect")
{< br> page. clientscript. registerstartupscript (page. getType (), "alertandredirect", String. format (JS, message, tourl);
}< BR ># endregion
}
/// <Summary>
/// Return to the history page
/// </Summary>
/// <Param name = "value">-1/1 </param>
Public static void gohistory (INT value, page)
{
# Region
String JS = @ "<script language = 'javascript '>
History. Go ({0 });
</SCRIPT> ";
// Httpcontext. Current. response. Write (string. Format (JS, value ));
If (! Page. clientscript. isstartupscriptregistered (page. GetType (), "gohistory "))
{
Page. clientscript. registerstartupscript (page. GetType (), "gohistory", String. Format (JS, value ));
}
# Endregion
}
/// <Summary>
/// Close the current window
/// </Summary>
Public static void closewindow ()
{
# Region
String JS = @ "<script language = 'javascript '>
Parent. Opener = NULL; window. Close ();
</SCRIPT> ";
Httpcontext. Current. response. Write (JS );
Httpcontext. Current. response. End ();
# Endregion
}
///
// refresh the parent window
///
Public static void refreshparent (string URL, page)
{< br> # region
string JS = @ " ";
// httpcontext. current. response. write (JS);
If (! Page. clientscript. isstartupscriptregistered (page. getType (), "refreshparent")
{< br> page. clientscript. registerstartupscript (page. getType (), "refreshparent", JS);
}< BR ># endregion
}
///
// refresh the window.
///
Public static void refreshopener (page)
{< br> # region
string JS = @ " ";
// httpcontext. current. response. write (JS);
If (! Page. clientscript. isstartupscriptregistered (page. getType (), "refreshopener")
{< br> page. clientscript. registerstartupscript (page. getType (), "refreshopener", JS);
}< BR ># endregion
}
///
// open a new form of the specified size
///
// address
// width
// height
/// header position
/// left
Public static void openwebformsize (string URL, int width, int heigth, int top, int left, page)
{< br> # region
string JS = @ " ";
// httpcontext. current. response. write (JS);
If (! Page. clientscript. isstartupscriptregistered (page. getType (), "openwebformsize")
{< br> page. clientscript. registerstartupscript (page. getType (), "openwebformsize", JS);
}< BR ># endregion
}
/// <Summary>
/// Go to the URL-based page
/// </Summary>
/// <Param name = "url"> connection address </param>
Public static void javascriptlocationhref (string URL, page)
{
# Region
String JS = @ "<script language = 'javascript '>
Window. Location. Replace ('{0 }');
</SCRIPT> ";
JS = string. Format (JS, URL );
// Httpcontext. Current. response. Write (JS );
If (! Page. clientscript. isstartupscriptregistered (page. GetType (), "javascriptlocationhref "))
{
Page. clientscript. registerstartupscript (page. GetType (), "javascriptlocationhref", JS );
}
# Endregion
}
/// <Summary>
/// Open the mode dialog box with the specified size and position
/// </Summary>
/// <Param name = "webformurl"> connection address </param>
/// <Param name = "width"> width </param>
/// <Param name = "height"> height </param>
/// <Param name = "TOP"> distance from top </param>
/// <Param name = "Left"> left </param>
Public static void showmodaldialogwindow (string webformurl, int width, int height, int top, int left, page)
{
# Region
String features = "dialogwidth:" + width. tostring () + "PX"
+ "; Dialogheight:" + height. tostring () + "PX"
+ "; Dialogleft:" + left. tostring () + "PX"
+ "; Dialogtop:" + TOP. tostring () + "PX"
+ "; Center: Yes; help = no; resizable: No; Status: No; scroll = yes ";
Showmodaldialogwindow (webformurl, features, page );
# Endregion
}
/// <Summary>
/// Pop-up modal window
/// </Summary>
/// <Param name = "webformurl"> </param>
/// <Param name = "Features"> </param>
Public static void showmodaldialogwindow (string webformurl, string features, page)
{
String JS = showmodaldialogjavascript (webformurl, features );
// Httpcontext. Current. response. Write (JS );
If (! Page. clientscript. isstartupscriptregistered (page. GetType (), "showmodaldialogwindow "))
{
Page. clientscript. registerstartupscript (page. GetType (), "showmodaldialogwindow", JS );
}
}
/// <Summary>
/// Pop-up modal window
/// </Summary>
/// <Param name = "webformurl"> </param>
/// <Param name = "Features"> </param>
/// <Returns> </returns>
Public static string showmodaldialogjavascript (string webformurl, string features)
{
# Region
String JS = @ "<script language = JavaScript>
Showmodaldialog ('"+ webformurl +"', '', '" + features + "'); </SCRIPT> ";
Return JS;
# Endregion
}