How to make Button_click event trigger automatically?

Hi, I want to make button_click event trigger automatically without clicking button.
Please help me.
tamelarasiAsked:
Who is Participating?
 
David H.H.LeeConnect With a Mentor Commented:
Hi tamelarasi,
>>...make button_click event trigger automatically without clicking button.
You can invoke the button's onclick event manually inside your preferrable function.
eg:

void Page_Load(){
  //call button onclick event manually, pass null parameter
  btn_click(null,null)
}
0
 
VenkatgviCommented:
hi,
As said by x_com u can invoke button_click event wherever you like

change  is
object sender, EventArgs e

void Page_Load()
{
  //call button onclick event manually, pass null parameter
  EventArgs ex = new EventArgs();
  btn_click((object) <Button_NAME>,ex);
}
0
 
shivanshuvermaCommented:
Hi
call button click event on page lode and pass null parameter into the button click function.
example:-

void Page_Load()
{

  btnSave_click(null,null)
}
 i hope it will help u............
0
 
JackOfPHCommented:
My suggestions is to put the code of the button inside a new function then instead of calling the button click event call the function instead.

0
All Courses

From novice to tech pro — start learning today.