using javascript __doPostBack inside C# code-behinde

Discussion in 'ASP .Net' started by bredal Jensen, Apr 27, 2004.

  1. I'm trying to generate a postback to the server when
    my radio button is selected.

    This code MyRadio.Attributes.Add("onclick",__doPosback(info,'')) does
    generate a javascript error.
    Info is an integer value i need to send to my server in the query string
    .....
    Can someone help me with this?

    Thanks
     
    bredal Jensen, Apr 27, 2004
    #1
    1. Advertising

  2. Hi bredal Jensen,

    try this.
    MyRadio.Attributes.Add("onclick","__doPosback("+ info.ToString() +",'')");

    HTH
    Regards
    Ashish M Bhonkiya

    "bredal Jensen" <> wrote in message
    news:...
    >
    > I'm trying to generate a postback to the server when
    > my radio button is selected.
    >
    > This code MyRadio.Attributes.Add("onclick",__doPosback(info,'')) does
    > generate a javascript error.
    > Info is an integer value i need to send to my server in the query string
    > ....
    > Can someone help me with this?
    >
    > Thanks
    >
    >
     
    Ashish M Bhonkiya, Apr 27, 2004
    #2
    1. Advertising

  3. That worked great..
    By the way, how many different parameters can one send in the __DoPostBack
    function as query string.
    I failed to fin any documentaion of that function.

    Again , many thanks for your great support.





    "Ashish M Bhonkiya" <> wrote in message
    news:...
    > Hi bredal Jensen,
    >
    > try this.
    > MyRadio.Attributes.Add("onclick","__doPosback("+ info.ToString() +",'')");
    >
    > HTH
    > Regards
    > Ashish M Bhonkiya
    >
    > "bredal Jensen" <> wrote in message
    > news:...
    > >
    > > I'm trying to generate a postback to the server when
    > > my radio button is selected.
    > >
    > > This code MyRadio.Attributes.Add("onclick",__doPosback(info,'')) does
    > > generate a javascript error.
    > > Info is an integer value i need to send to my server in the query string
    > > ....
    > > Can someone help me with this?
    > >
    > > Thanks
    > >
    > >

    >
    >
     
    bredal Jensen, Apr 27, 2004
    #3
  4. Well , i just found out that i may not need javascript to accomplish this.

    I could use the following:


    MyRadio.AutoPostBack = true;

    I also think this solution should be more appropriate for my problem.
    Now , the problem how do i define the message handler when my "click"
    generate a postback.

    I tried :

    MyRadio.Attribute.Add("onclick","MyClcick_handler");


    But it does not seem to do the magic.


    Any idea?






    "bredal Jensen" <> wrote in message
    news:...
    > That worked great..
    > By the way, how many different parameters can one send in the __DoPostBack
    > function as query string.
    > I failed to fin any documentaion of that function.
    >
    > Again , many thanks for your great support.
    >
    >
    >
    >
    >
    > "Ashish M Bhonkiya" <> wrote in message
    > news:...
    > > Hi bredal Jensen,
    > >
    > > try this.
    > > MyRadio.Attributes.Add("onclick","__doPosback("+ info.ToString()

    +",'')");
    > >
    > > HTH
    > > Regards
    > > Ashish M Bhonkiya
    > >
    > > "bredal Jensen" <> wrote in message
    > > news:...
    > > >
    > > > I'm trying to generate a postback to the server when
    > > > my radio button is selected.
    > > >
    > > > This code MyRadio.Attributes.Add("onclick",__doPosback(info,'')) does
    > > > generate a javascript error.
    > > > Info is an integer value i need to send to my server in the query

    string
    > > > ....
    > > > Can someone help me with this?
    > > >
    > > > Thanks
    > > >
    > > >

    > >
    > >

    >
    >
     
    bredal Jensen, Apr 27, 2004
    #4
  5. Myradio is genearted dynamically and i can therefore not define
    The click event handler in my aspx file.

    "MyRadio.AutoPostBack = true" does in fact generate the
    postback event.

    I'm therefore temptaed to use delegates .

    But if someone find a better solution then
    i would be happy to know....


    Thanks


    "bredal Jensen" <> wrote in message
    news:OTQ%...
    > Well , i just found out that i may not need javascript to accomplish this.
    >
    > I could use the following:
    >
    >
    > MyRadio.AutoPostBack = true;
    >
    > I also think this solution should be more appropriate for my problem.
    > Now , the problem how do i define the message handler when my "click"
    > generate a postback.
    >
    > I tried :
    >
    > MyRadio.Attribute.Add("onclick","MyClcick_handler");
    >
    >
    > But it does not seem to do the magic.
    >
    >
    > Any idea?
    >
    >
    >
    >
    >
    >
    > "bredal Jensen" <> wrote in message
    > news:...
    > > That worked great..
    > > By the way, how many different parameters can one send in the

    __DoPostBack
    > > function as query string.
    > > I failed to fin any documentaion of that function.
    > >
    > > Again , many thanks for your great support.
    > >
    > >
    > >
    > >
    > >
    > > "Ashish M Bhonkiya" <> wrote in message
    > > news:...
    > > > Hi bredal Jensen,
    > > >
    > > > try this.
    > > > MyRadio.Attributes.Add("onclick","__doPosback("+ info.ToString()

    > +",'')");
    > > >
    > > > HTH
    > > > Regards
    > > > Ashish M Bhonkiya
    > > >
    > > > "bredal Jensen" <> wrote in message
    > > > news:...
    > > > >
    > > > > I'm trying to generate a postback to the server when
    > > > > my radio button is selected.
    > > > >
    > > > > This code MyRadio.Attributes.Add("onclick",__doPosback(info,''))

    does
    > > > > generate a javascript error.
    > > > > Info is an integer value i need to send to my server in the query

    > string
    > > > > ....
    > > > > Can someone help me with this?
    > > > >
    > > > > Thanks
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    bredal Jensen, Apr 27, 2004
    #5
    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. Nikhil Patel

    javascript:__doPostBack error

    Nikhil Patel, Feb 26, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    8,104
    Scott M.
    Feb 26, 2004
  2. Fredrik Elestedt

    __dopostback javascript problem

    Fredrik Elestedt, Apr 22, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    5,879
    John Saunders
    Apr 23, 2004
  3. Adrian
    Replies:
    1
    Views:
    3,353
    Adrian
    Apr 26, 2004
  4. Granger Godbold
    Replies:
    0
    Views:
    996
    Granger Godbold
    May 12, 2004
  5. Murray Patrick via DotNetMonster.com

    __doPostBack Error -- Javascript

    Murray Patrick via DotNetMonster.com, Feb 11, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    2,719
    Murray Patrick via DotNetMonster.com
    Feb 11, 2005
Loading...

Share This Page