New Message on dotNET User Group Hyd

Question Of The Day !!!!

Reply
  Reply to Sender   Recommend Message 3 in Discussion
From: rj_khatri

The common way to accomplish this is to use RegisterStartupScript and the RegisterClientScriptBlock methods of the Page class.
 
Page.RegisterStartupScript -
This method adds _javascript_ to the web form right before the ending </form> tag.
This wouls be best used when we want to initiate a _javascript_ function when the page is loaded. It takes two parameters
� the first being the key of the script and the
--  the second being the script itself (represented as a string).
 
private void Page_Load(object sender, System.EventArgs e)
{
           -----
           -----
           Page.RegisterStartupScript("UserScript",
                       "<script language=_javascript_>" +
                        "function HelloWorld() { alert('Hello World'); }</script>");
          Button1.Attributes["onclick"] = "HelloWorld()";
          -----
          -----
}
 
Page.RegisterClientScriptBlock -
This method adds _javascript_ to the web form, right after the <form runat="server"> declaration.  It also takes two parameters� the first being the key of the script and the second being the script itself (represented as a string).
 
The main difference between the two methods is that the RegisterStartupScript method places the _javascript_ at the bottom of the ASP.NET page right before the closing </form> element while RegisterClientScriptBlock method places the _javascript_ directly after the opening <form> element in the page.

View other groups in this category.

Click Here
Also on MSN:
Start Chatting | Listen to Music | House & Home | Try Online Dating | Daily Horoscopes

To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.

Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.

If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.

Reply via email to