Click here to Skip to main content
15,917,456 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how do i call the click event of other button .

suppose i click on any button , then after some processing i want to call the click event any other button.
means manually fire button event.


actually i want to alert the user that record saved successfully....
how to do that

i used this in page_load
Button2.Attributes.Add("onclick", "alert('Record saved successfully......')");

but the alert pops before the code under click event is executed...

no i m not using Ajax. as i m begineer.

any help ?

Thanks in advance
Posted
Updated 21-Jul-11 21:02pm
v4

Write the below code in the last line of your button click event.
otherButton(sender,e)
 
Share this answer
 
Comments
Member 8043849 22-Jul-11 2:54am    
actually i want to alert the user that record saved successfully....

how to do that
Toniyo Jackson 22-Jul-11 2:55am    
Are you using AJAX? If you are using ajax try this.

ScriptManager.RegisterStartupScript(Me, Me.GetType(), "msg", "alert('Your message here');", True)
C#
protected void Page_Load(object sender, EventArgs e)
{
//after some processing call the buttonclick event
btnOther_Click(btnOther, new EventArgs());
}
 
Share this answer
 
Comments
Member 8043849 22-Jul-11 2:54am    
actually i want to alert the user that record saved successfully....

how to do that
you can callup directly bu just giving event name and parameters

private void btnDemo_Click(object sender, System.EventArgs e)
{
      btnSave_Click(sender, e);
}
 
Share this answer
 
Comments
Member 8043849 22-Jul-11 2:54am    
actually i want to alert the user that record saved successfully....

how to do that
you just have to write.

btnName_Cick(sender,e);
 
Share this answer
 
hi,
just use a label to display your message if the inserion is successfull.
regards,
shefeek
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900