ASP.NET - calling javascript function
Asked By srikar
09-Sep-10 02:12 AM
am calling javascript function on page load is it right r wrong plz currect me.
protected void Page_Load(object sender, EventArgs e)
{
Button1.Attributes["onclck"] = "javascript:return(createCustomAlert);";
}
Reena Jain replied to srikar
hi,
yes it is correct srikar
srikar replied to Reena Jain
Sagar P replied to srikar
Yes it is right. Even you can also do it by using;
Button1.Attributes.Add("onclick","javascript:return createCustomAlert();");
But it will not call this function on page load, it will call this function once you click on BUTTON1
Anand Malli replied to srikar
There is another way as well...if you do not want to register on server side,you can do like following
<asp:Button id="btn" runat="server" OnClientClick="return CreateCustomAlert();" />
so there are more den one way...
thxs
Goniey N replied to srikar
-- There Is Spelling Mistake In Your Code :
protected void Page_Load(object sender, EventArgs e)
{
//Here You Written "onclck", Actually It Is "onclick"... So Correct it....
Button1.Attributes["onclick"] = "javascript:return(createCustomAlert);";
}
-- Now This Will Work perfectly & Other Ways Which Are Already Displayed By Other That Also Works...
srikar replied to Goniey N
Net hi friends Any one send frequently asked Important questions in C# .Net, ADO .Net, Asp .Net and Sql Server. . . . . . . . tx in Advance. . . . . . Hi, Find this. . (B)What is an IL? (B A) What is scavenging? (B) What are different types of caching using cache object of ASP.NET? (B) How can you cache different version of same page using ASP.NET cache object? (A) How will implement Page Fragment Caching? (B) Can you compare ASP.NET sessions with classic ASP? (B) Which are
faqs on masterpages Hi all, can anybody tell me the FAQs on Masterpages in asp.net. Thanks alot var Hi What are Master Pages in ASP.NET? or What is a Master Page? ASP.NET master pages allow you to create a consistent layout for the pages in your application A single master page defines the look and feel and standard behavior that you want for all of the
Migration from ASP to ASP.net How to convert ASP site to ASP.NET site using C# http: / / www.asp.net / downloads / archived-v11 / migration-assistants / asp-to-aspnet hi, ASP.NET framework is very much different from unstrucured ASP and there is no correct way to
share session between Classic ASP applications and ASP.NET applications? I want to share session state between Classic ASP applications and ASP.NET applications. Can we share ? if yes , How ? Yes, it can. See the article at the user session, and can be used to identify session state for both classic ASP and ASP.NET. Session state information is stored in memory in ASP script and can't be shared with other applications, such as ASP.NET. If the session state is stored in a common format in Microsoft® SQL Server, the
session is user based mean u can differentiate login user in different way • Process independent. ASP.NET session state is able to run in a separate process from the ASP.NET host process. If session state is in a separate process, the ASP.NET process can come and go while the session state process remains available. Of course, you ASP, too. • Support for server farm configurations. By moving to an out-of-process model, ASP.NET also solves the server farm problem. The new out-of-process model allows all servers