Sunday, March 11, 2012

Radiobuttonlist and AJAX Collapsible Panel Extender

That is a good question...

I did notice that the "Yes" option did not have a value attribute set.

<asp:ListItem>Yes</asp:ListItem>

<asp:ListItemValue="N">No</asp:ListItem>

<asp:ListItemValue="U">NS</asp:ListItem>


I fixed the value and I'm making some progress - with visible and non-visible but I really want the collapsiblepanelExtender to work...

<asp:UpdatePanelid="UpdatePanel"runat="server"UpdateMode="Conditional">

<contenttemplate>

<

asp:RadioButtonListid="testRadio"runat="server"Width="298px"RepeatLayout="Flow"RepeatDirection="Horizontal"AutoPostBack="True"><asp:ListItemValue="Y">Yes</asp:ListItem><asp:ListItemValue="N">No</asp:ListItem><asp:ListItemValue="U">NS</asp:ListItem></asp:RadioButtonList><asp:Panelid="testPanel"runat="server"Width="299px"BackColor="Ivory"Height="56px"Visible="False"><BR/>Example of radiolist and AJAX on yes!<BR/></asp:Panel><cc1:CollapsiblePanelExtenderid="testCollapsiblePanelExtender"runat="server"__designer:wfdid="w20"TargetControlID="testPanel"></cc1:CollapsiblePanelExtender>

</

contenttemplate></asp:UpdatePanel>

/// code behind

ProtectedSub testRadio_SelectedIndexChanged(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles testRadio.SelectedIndexChanged

If testRadio.SelectedValue ="Y"Then

testPanel.Visible =

TrueElse

testPanel.Visible =

FalseEndIf

EndSub


I don't think you can use ONE radio list to do what you are attempting.

The collapsible panel only toggles it's "state" with each click of the respective expand and collaps control. So if the expand and collaps control id is the same then you will only be toggleing on the "CLICK" of the control not the value.

Give me a minute or two to come up with a way around that.

Huh?


Ok how's this?

I know you want to use the value of the radio list as for updating a table. Probably using a sqlDataSource. How about you do this. Create another hidden field that the datasource is connected to. Then when the user clicks the radio list, use the codebehind click event (or whatever the event is) to change the value of the hidden field.

What do you think?

I'm not an expert (per se) with the AJAX stuff.

No comments:

Post a Comment