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