Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / JScript / August 2003

Tip: Looking for answers? Try searching our database.

2 radiobuttonlists for selection

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sramruttun - 06 Aug 2003 06:39 GMT
hi

I have 2 radiobuttonlists in my form both having more or less the same
listitems:
At Design time,
RDLGroup1 (1st radiobuttonlist) has the foll. items:
A1 A2 A3 A4 A5 (A1 is selected)

RDLGroup2 (2nd radiobuttonlist) has the foll. items:
A2 A3 A4 A5 (None is selected)

So at first, if I select A2 in RDLGroup1, then A2 should be removed from
RDLGroup2 and A1 should be added to it.
Similarly, later if I select A5 in RDLGroup1, then A5 should be removed from
RDLGroup2 and the item that was previously 'absent' should be added.
That is, each time an item is selected in RDLGroup1, then it should be
removed from RDLGroup2 and the item that was previously removed should be
added.
So I set autopostback true for RDLGroup1, and added code to do that in the
selectedindexchanged event of RDLGroup1. It works. But the postback has a
specific problem (it is not relevant here but I can explain later) so that I
can't use this postback method. I'm left with javascript. So my question is:
How can I do the removal and additions of items in the radiobuttonlists in
javascript?

Note: I'm using these 2 radiobutonlists to provide 2 level grouping for
reports. So it's obvious that if I select one item for the 1st level
grouping I can't select it again for the 2nd level grouping as well.

Any suggestions will be ok - probably some other method to achieve the above
functionality.
Jason Kleban - 18 Aug 2003 23:39 GMT
<FORM>
<DIV ID="GroupOneDiv">
</DIV>
<DIV ID="GroupTwoDiv">
</DIV>
</FORM>

// OnLoad, initialize the lists and respond to events the
// following.

// Javascript

// Depending on your data and setup, you'll want to
// devise a method of keeping track of the different
// options so you can move them back and forth between
// lists or whatever.

// then you can add elements like this
var myDiv = document.getElementById("GroupOneDiv");
var newRadioBtn = document.createElement("input");
newRadioBtn.type = "radio";
newRadioBtn.value = "Put your logic here";
// other attributes here, possibly an ID

// Add the radio button to the form.
myDiv.appendChild(newRadioBtn);

// You can remove buttons like this
RadioBtnElement = document.GetElementById(whatever);
// or
RadioBtnElement = yourElementReferenceStorageSystem[?];
myDiv.remove(RadioBtnElement);

Jason

>-----Original Message-----
>hi
[quoted text clipped - 30 lines]
>
>.
sramruttun - 19 Aug 2003 10:18 GMT
thanks for your reply,

I would like to add a few points and then probably u may suggest some
solution:

A friend like u told me that:

.Net renders every radio list to table and every radio button name is
combination of the List control name plus the Item name (u can see that when
u do view source of the page - indeed it is true). You can use that data to
set HTML item visibility like this:

window.document.all["RadioButtonList2_0"].style["visibility"]

Now I need to iterate the Table elements - every TR got TD that got the
radio button and text. How can it be done it in javascript?

> <FORM>
> <DIV ID="GroupOneDiv">
[quoted text clipped - 80 lines]
> >
> >.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.