[ASP.net] Loading production

Source: Internet
Author: User
Tags net tostring
The Asp.net|loading|asp.net|loading method is simple. Put the code up!
It was packed into a control. Download Address:
http://upserver4.ys168.com/ys168up/D1/YY1.aspx?f= 050p1d8e0e3e5d9d5g6ali7a00a05aka03d6a00a08a08i5f9g0e0d9e0d8d6e1a24e6e1d9e5d9c3

The following is the source code:

===================================

Using System;

Namespace Hdcontrol
{
<summary>
Summary description for Loading.
</summary>
public class Loading
{
Private System.Web.UI.Page Sender;
private string strImagePath;

public Object Page
{
Get
{
return Sender;
}
Set
{
Sender = (System.Web.UI.Page) value;
}
}

public string imagemapth
{
Get
{
return strImagePath;
}
Set
{
strImagePath = value;
}
}

Public Loading ()
{
//
}

Public Loading (object sender)
{
Page = sender;
}

Public Loading (Object sender,string imagemapth)
{
Page = sender;
This.strimagepath = imagemapth;
}

<summary>
Load script to Page
</summary>
public void Load ()
{
if (!this. Sender.isclientscriptblockregistered ("Startscript"))
{
This. Sender.registerclientscriptblock ("Startscript", this. Start ());
This. Sender.registerstartupscript ("Endscript", this. End ());
}
}

<summary>
Script start.
</summary>
<returns></returns>
private String Start ()
{
String strstyle = "Border-top-style:none;" Border-right-style:none; Border-left-style:none; Border-bottom-style:none ";
System.Text.StringBuilder strscript = new System.Text.StringBuilder ();
Strscript.append ("<div id=\" loading\ ">");
Strscript.append ("<table width=\" 100%\ "height=\" 100%\ "border=\" 0\ "cellpadding=\" 0\ "cellspacing=\" 0\ "style=\" "+ Strstyle +" \ ">");
Strscript.append ("<tr style=\" "+ Strstyle +" \ "><td width=\" 100%\ "height=\" 100%\ "align=\" Center\ "valign=\" Middle\ "style=\" "+ Strstyle +" \ ">");
Strscript.append ("Strscript.append ("</td></tr>");
Strscript.append ("</table></div>");
return strscript.tostring ();
}

<summary>
Script end.
</summary>
<returns></returns>
private String End ()
{
System.Text.StringBuilder strscript = new System.Text.StringBuilder ();
Strscript.append ("<script language=\" javascript\ ">");
Strscript.append ("Window.document.getElementById" ("loading\"). Style.display = \ "None\"; ");
Strscript.append ("</script>");
return strscript.tostring ();
}
}
}


=========================

First in the face page

Using Hdcontrol;

Call method (in Page_Load):

loadingcontrol.loading objload = new Loadingcontrol.loading (This, "images/loading.gif");
Objload.load ();

Or:

loadingcontrol.loading objload = new loadingcontrol.loading ();
Objload.page = this;
objload.imagemapth = "Images/loading.gif";
Objload.load ();




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.