Link to cause postback

Discussion in 'ASP .Net' started by martin, May 12, 2004.

  1. martin

    martin Guest

    Hi,

    I would like to place a normal link <a href=..> on my webpage and when it is
    clicked for the form to be posted back.

    I guess that I will have to have to link point to some javascript code and
    have the javascript code "submit" the form, in order for the postback to be
    initialed.

    Could somebody please tell me how I would initiate a form submission from
    javascript so that a specific handler runs when the page is submitted.

    I know that I could use a button for this for a button does not suit my
    needs.

    any help is appreciated.

    cheers

    martin.
    martin, May 12, 2004
    #1
    1. Advertising

  2. martin

    Ben de Vette Guest

    Martin.

    I think the LinkButton will do the job.
    It is a link with some javascript code which submits the form.

    The generated HTML looks like this:
    <a id="ToppageUC1_Mainmenubuild2_BemestingButton1_LinkButton1"
    class="MenuButton"
    href="javascript:__doPostBack('ToppageUC1$Mainmenubuild2$BemestingButton1$Li
    nkButton1','')">Düngemittel</a>

    As you can see, it is a normal link, but the href contains the Autogenerated
    javascript.

    Greetz,
    Ben

    "martin" <> wrote in message
    news:...
    > Hi,
    >
    > I would like to place a normal link <a href=..> on my webpage and when it

    is
    > clicked for the form to be posted back.
    >
    > I guess that I will have to have to link point to some javascript code and
    > have the javascript code "submit" the form, in order for the postback to

    be
    > initialed.
    >
    > Could somebody please tell me how I would initiate a form submission from
    > javascript so that a specific handler runs when the page is submitted.
    >
    > I know that I could use a button for this for a button does not suit my
    > needs.
    >
    > any help is appreciated.
    >
    > cheers
    >
    > martin.
    >
    >
    >
    >
    Ben de Vette, May 12, 2004
    #2
    1. Advertising

  3. I'm curious as to why you can't use a server-side linkbutton control. You
    wouldn't need the JavaScript.

    "martin" <> wrote in message
    news:...
    > Hi,
    >
    > I would like to place a normal link <a href=..> on my webpage and when it
    > is
    > clicked for the form to be posted back.
    >
    > I guess that I will have to have to link point to some javascript code and
    > have the javascript code "submit" the form, in order for the postback to
    > be
    > initialed.
    >
    > Could somebody please tell me how I would initiate a form submission from
    > javascript so that a specific handler runs when the page is submitted.
    >
    > I know that I could use a button for this for a button does not suit my
    > needs.
    >
    > any help is appreciated.
    >
    > cheers
    >
    > martin.
    >
    >
    >
    >
    Ken Cox [Microsoft MVP], May 12, 2004
    #3
  4. martin

    martin Guest

    Thnak you for that.

    A link button will work fine.

    cheers

    martin.


    "Ben de Vette" <> wrote in message
    news:...
    > Martin.
    >
    > I think the LinkButton will do the job.
    > It is a link with some javascript code which submits the form.
    >
    > The generated HTML looks like this:
    > <a id="ToppageUC1_Mainmenubuild2_BemestingButton1_LinkButton1"
    > class="MenuButton"
    >

    href="javascript:__doPostBack('ToppageUC1$Mainmenubuild2$BemestingButton1$Li
    > nkButton1','')">Düngemittel</a>
    >
    > As you can see, it is a normal link, but the href contains the

    Autogenerated
    > javascript.
    >
    > Greetz,
    > Ben
    >
    > "martin" <> wrote in message
    > news:...
    > > Hi,
    > >
    > > I would like to place a normal link <a href=..> on my webpage and when

    it
    > is
    > > clicked for the form to be posted back.
    > >
    > > I guess that I will have to have to link point to some javascript code

    and
    > > have the javascript code "submit" the form, in order for the postback to

    > be
    > > initialed.
    > >
    > > Could somebody please tell me how I would initiate a form submission

    from
    > > javascript so that a specific handler runs when the page is submitted.
    > >
    > > I know that I could use a button for this for a button does not suit my
    > > needs.
    > >
    > > any help is appreciated.
    > >
    > > cheers
    > >
    > > martin.
    > >
    > >
    > >
    > >

    >
    >
    martin, May 12, 2004
    #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. Vidar Petursson

    Re: Client side action to cause postback

    Vidar Petursson, Jul 11, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    518
    David Waz...
    Jul 11, 2003
  2. szabelin

    cause page to postback to server?

    szabelin, Aug 20, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    347
    szabelin
    Aug 20, 2003
  3. dee
    Replies:
    11
    Views:
    8,692
    Mingus
    Mar 3, 2009
  4. Kevin Spencer

    Re: Link Link Link DANGER WILL ROBINSON!!!

    Kevin Spencer, May 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    800
    Kevin Spencer
    May 17, 2005
  5. Replies:
    4
    Views:
    1,644
    Eliyahu Goldin
    Jul 25, 2005
Loading...

Share This Page