Click here to Skip to main content
16,016,168 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello Friends


i have question for to call a page load event while button click..because i have some code that i have must have to write under in page_load. when i click an button there was some code and after that i want to fire page_load event there...

Is there possible..


Thank You..
Posted

1. Write a function whatever you have written in Page_Load.
2. Call it where ever you need

C#
private MyFunc()
{
   //Your code goes here.
}
protected void Page_Load(object sender, EventArgs e)
{
 MyFunc();
}
 protected void Button_Click(object sender, EventArgs e)
{
  MyFunc();
}
 
Share this answer
 
Comments
Yatin chauhan 20-Oct-12 9:04am    
thx for that...
i need a page load event fire while i click a button.
Sanjay K. Gupta 20-Oct-12 9:06am    
you can call also as

Page_Load(null,null);
Sanjay K. Gupta 20-Oct-12 9:07am    
Page_Load nothing but a function.
Call it as a function
Try the code after you done with your logic on button click

C#
Response.Redirect(Request.Url.AbsoluteUri);
 
Share this answer
 
v2

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