Programmatic Click

R

randy.buchholz

Am I missing something simple? I can't find a way to click a
button/linkbutton from my C# code. Specifically, I am trying to fire the
"New" button in a Details View to switch to insert mode.
 
A

AlBruAn

Use the following line, replacing Button1 with the name of your "New" button:

((IPostBackEventHandler)Button1).RaisePostBackEvent(null);
 
R

randy.buchholz

Cool! Thanks.

AlBruAn said:
Use the following line, replacing Button1 with the name of your "New"
button:

((IPostBackEventHandler)Button1).RaisePostBackEvent(null);
 
P

Phil H

Am I missing something simple?  I can't find a way to click a
button/linkbutton from my C# code.  Specifically, I am trying to fire the
"New" button in a Details View to switch to insert mode.

What you are missing is the fact that the Click event is supposed to
be fired by the User on the client. If you want to put the DetailsView
control into Insert mode programmatically then just do this:

YourDetailsView.ChangeMode(DetailsViewMode.Insert)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,077
Messages
2,570,566
Members
47,202
Latest member
misc.

Latest Threads

Top