using javascript __doPostBack inside C# code-behinde

B

bredal Jensen

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
 
A

Ashish M Bhonkiya

Hi bredal Jensen,

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

HTH
Regards
Ashish M Bhonkiya
 
B

bredal Jensen

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.
 
B

bredal Jensen

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?
 
B

bredal Jensen

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
 

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
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top