| | |
radiobuttonlist postback error
Please support our ASP.NET advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Jul 2009
Posts: 7
Reputation:
Solved Threads: 0
Hi all,
I've got a spot of bother with my radiobuttonlist. It has 3 items in it and I want them to control the visibility of certain divs/tables.
But even simple text changes are becoming a headache and the postback is not firing the event I clicked on but the PREVIOUS event (ie, I click on value 1 and text shows nothing, I click on value 2 and text shows value 1, I click on value 3 and text shows value 2)...always 1 step behind.
Here's my code:
I've tried combinations of adding attributes in the vb.net pageload function, the vb.net code behind rdoList.selectindexchange using
rdolist.Attributes.Add("onload", "javascript
etMessageInTextbox()")
and also the onClick event of the HTML page.
If you can assist, please do.
I've got a spot of bother with my radiobuttonlist. It has 3 items in it and I want them to control the visibility of certain divs/tables.
But even simple text changes are becoming a headache and the postback is not firing the event I clicked on but the PREVIOUS event (ie, I click on value 1 and text shows nothing, I click on value 2 and text shows value 1, I click on value 3 and text shows value 2)...always 1 step behind.
Here's my code:
ASP.NET Syntax (Toggle Plain Text)
function SetMessageInTextbox() { var rdolist_0 = document.getElementById("rdolist_0"); var rdolist_1 = document.getElementById("rdolist_1"); var rdolist_2 = document.getElementById("rdolist_2"); if (rdolist_0.checked) document.getElementById("TextBox1").value="One"; if (rdolist_1.checked) document.getElementById("TextBox1").value="Two"; if (rdolist_2.checked) document.getElementById("TextBox1").value="Three"; }
I've tried combinations of adding attributes in the vb.net pageload function, the vb.net code behind rdoList.selectindexchange using
rdolist.Attributes.Add("onload", "javascript
etMessageInTextbox()")and also the onClick event of the HTML page.
If you can assist, please do.
1
#2 Nov 1st, 2009
HI,
You can use the below javascript method to read asp radio button list selectindex, selected value.
WHERE Aspradiobuttonlist is the id of radiobuttonlist server control.
Hope it will help you.
You can use the below javascript method to read asp radio button list selectindex, selected value.
ASP.NET Syntax (Toggle Plain Text)
<script type="text/javascript"> function GetRadioButtonSelectedValue() { var AspRadio = document.getElementsByName('Aspradiobuttonlist'); for (var i = 0; i < AspRadio.length; i++) { if (AspRadio[i].checked) { var lblAspradiobuttonValue = document.getElementById('<%= lblAspradiobuttonValue.ClientID %>'); lblAspradiobuttonValue.innerHTML='<b>Selected Value:</b> '+AspRadio[i].value+'<br/>'; lblAspradiobuttonValue.innerHTML+='<b>Selected Text:</b> '+AspRadio[i].parentNode.getElementsByTagName('label')[0].innerHTML; }//end if }// end for }//end function </script>
WHERE Aspradiobuttonlist is the id of radiobuttonlist server control.
Hope it will help you.
Last edited by mail2saion; Nov 1st, 2009 at 5:35 am.
MARK AS SOLVED if its help you.
REGARDS
MCTS - Shawpnendu bikash maloroy
http://shawpnendu.blogspot.com
REGARDS
MCTS - Shawpnendu bikash maloroy
http://shawpnendu.blogspot.com
•
•
Join Date: Jul 2009
Posts: 7
Reputation:
Solved Threads: 0
0
#3 Nov 3rd, 2009
Hi,
Thanks for the reply. Unfortunately, you're code doesn't have the desired result. What does seem to happen is that if I make a selection, no answer will appear, but if I next press the area around a radiobutton, but still on the radiobuttonlist control, it will respond with the correct response.
So in other words, the change of index doesn't fire the function, but clicking the list (not a direct radiobutton) does.
This is counter-intuitive if you ask me and I can't expect the users of the page to do this.
Any clues?
Thanks again.
Thanks for the reply. Unfortunately, you're code doesn't have the desired result. What does seem to happen is that if I make a selection, no answer will appear, but if I next press the area around a radiobutton, but still on the radiobuttonlist control, it will respond with the correct response.
So in other words, the change of index doesn't fire the function, but clicking the list (not a direct radiobutton) does.
This is counter-intuitive if you ask me and I can't expect the users of the page to do this.
Any clues?
Thanks again.
![]() |
Other Threads in the ASP.NET Forum
- Previous Thread: redirecting back to referrer page in asp.net
- Next Thread: Crystal Report Best Practice Question
Views: 411 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 activexcontrol advice ajax alltypeofvideos anathor application asp asp.net bc30451 bottomasp.net box browser button c# checkbox click commonfunctions complex connection dataaccesslayer database datagridview datagridviewcheckbox datalist development dgv dropdownlist dynamically edit editing expose feedback fileuploader fill flash form formatdecimal formview google gridview gudi iframe iis javascript list listbox login microsoft migration mono mouse mssql news numerical opera panelmasterpagebuttoncontrols parent problem project radio redirect registration relationaldatabases reportemail richtextbox rows save schoolproject search security select session silverlight smartcard smoobjects software sql sql-server sqlserver2005 suse textbox theft tracking unauthorized validation vb.net video videos view vista visualstudio web webapplications webdevelopemnt webprogramming webservice xsl youareanotmemberofthedebuggerusers





