Programmatic Click

Discussion in 'ASP .Net Web Controls' started by randy.buchholz, Jan 8, 2008.

  1. 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.
     
    randy.buchholz, Jan 8, 2008
    #1
    1. Advertising

  2. randy.buchholz

    AlBruAn Guest

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

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

    "randy.buchholz" wrote:

    > 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.
    >
    >
    >
     
    AlBruAn, Jan 8, 2008
    #2
    1. Advertising

  3. Cool! Thanks.

    "AlBruAn" <.(donotspam)> wrote in message
    news:...
    > Use the following line, replacing Button1 with the name of your "New"
    > button:
    >
    > ((IPostBackEventHandler)Button1).RaisePostBackEvent(null);
    >
    > "randy.buchholz" wrote:
    >
    >> 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.
    >>
    >>
    >>
     
    randy.buchholz, Jan 8, 2008
    #3
  4. randy.buchholz

    Phil H Guest

    On 8 Jan, 16:37, "randy.buchholz" <>
    wrote:
    > 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)
     
    Phil H, Jan 9, 2008
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael Porcelli
    Replies:
    1
    Views:
    380
    »OÆW·L³n§Þ³N¤ä´©³¡
    Jul 28, 2003
  2. DV
    Replies:
    10
    Views:
    2,592
  3. Hai Nguyen

    Datagrid Programmatic

    Hai Nguyen, Jan 16, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    923
    Norman Yuan
    Jan 17, 2004
  4. Paul Mason

    Programmatic production of HTML...

    Paul Mason, Apr 30, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    395
    coollzh
    Apr 30, 2004
  5. Bill Cohagan

    Programmatic construction of httprequest?

    Bill Cohagan, Aug 13, 2004, in forum: ASP .Net
    Replies:
    19
    Views:
    1,035
    Bill Cohagan
    Aug 18, 2004
Loading...

Share This Page