Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > How to make to RadioButtonList on the same group

Reply
Thread Tools

How to make to RadioButtonList on the same group

 
 
John Dow
Guest
Posts: n/a
 
      10-17-2007
I have two RadioButtonList that binding two seperate lists. However, I
would like to make them in the same group, which means when one
RadioButtonList has any selected item, the other RadioButtonList will have
no selected item.

Is there any way to do that easily?

Thanks


 
Reply With Quote
 
 
 
 
Mansi Shah
Guest
Posts: n/a
 
      10-17-2007
Hello John,


You want that when one RadioButtonList has any selected item, the other
RadioButtonList will have
no selected item.

So, for this you can use this sample code. Hope this will help you.
For this you have to set "AutoPostBack" property of Checkboxlist to
"True".

And then write the following code:

protected void RadioButtonList1_SelectedIndexChanged(object sender,
EventArgs e)
{
for (int i = 0; i < RadioButtonList1.Items.Count; i++)
{
if (RadioButtonList1.Items[i].Selected == true)
{
for (int j = 0; j < RadioButtonList2.Items.Count; j++)
RadioButtonList2.Items[j].Selected = false;
break;
}
}
}

Mansi Shah.

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
 
John Dow
Guest
Posts: n/a
 
      10-18-2007
Mansi ,

That works. Thanks so much.!


"Mansi Shah" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello John,
>
>
> You want that when one RadioButtonList has any selected item, the other
> RadioButtonList will have
> no selected item.
>
> So, for this you can use this sample code. Hope this will help you.
> For this you have to set "AutoPostBack" property of Checkboxlist to
> "True".
>
> And then write the following code:
>
> protected void RadioButtonList1_SelectedIndexChanged(object sender,
> EventArgs e)
> {
> for (int i = 0; i < RadioButtonList1.Items.Count; i++)
> {
> if (RadioButtonList1.Items[i].Selected == true)
> {
> for (int j = 0; j < RadioButtonList2.Items.Count; j++)
> RadioButtonList2.Items[j].Selected = false;
> break;
> }
> }
> }
>
> Mansi Shah.
>
> *** Sent via Developersdex http://www.developersdex.com ***



 
Reply With Quote
 
Mansi Shah
Guest
Posts: n/a
 
      10-18-2007

You are always Welcome John!

Mansi Shah.

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Multiple isakmp policies (Group 1 and Group 2) rmcnutt Cisco 1 07-13-2004 09:33 PM
Re: Which group is the PC discussion group (like comp.sys.mac.----)? philo Computer Support 0 08-03-2003 11:41 AM
Re: Which group is the PC discussion group (like comp.sys.mac.----)? LooseLips Computer Support 0 08-03-2003 08:37 AM



Advertisments