Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get the selected item in RadioButtonList that is in tab container?

Status
Not open for further replies.

saminetemad

Programmer
Dec 13, 2010
9
IR
Hi,
I have a radiobuttonlist and menu in the page and they in AJAX tab container .
I want when I click on the menu according to the Radio Button selected, a different display.
I wrote the following code:

function MenuItemSelected()
{ var radioButtons = document.getElementsByName("RadioButtonList1");

if(radioButtons[2].checked)
{
window.alert("jjjjjjj");
}
else
{
window.alert("tttttttttttttttttt");
}
}


These codes when radiobuttonlist and menu are out of the tab, working properly. but when radiobuttonlist and menu are out of the tab don't work properly.
 
These codes when radiobuttonlist and menu are out of the tab, working properly. but when radiobuttonlist and menu are out of the tab don't work properly.

I'm guessing you mean that when they are in the tab they don't work properly.

Without knowing what code you are using for your AJAX tabs, my guess would be that the tab contents are in an iframe, which would be a different document, and thus the document.getElementsByName call is not returning anything.

As I said - without either a URL to the failing page, or an error message, or knowing what tab system you're using, it's hard to do anything other than guess.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Snippets & Info:
The Out Atheism Campaign
 
By changing codes as following ,the problem is solved:

function MenuItemSelected()
{
var radioButtons = document.getElementsByName('<%=RadioButtonList1.UniqueID %>');

if(radioButtons[2].checked)
{
window.alert("jjjjjjj");
}
else
{
window.alert("tttttttttttttttttt");
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top