D
darrel
I have an asp:RadioButtonList. If one of the items is selected, I'd like a
text field to appear.
I tried using an ONCHANGE event via the codebehind, but couldn't get that to
work. Plus, I'm thinking that might not be the most accessible way to handle
this anyways.
So...I wanted to just attach a javascript event to the specific listitem and
have that toggle the visibility of the text field (wrapped in a span).
I have this on my codebehind:
--------------------------------------
Protected WithEvents RadioButtonList_categories_9 As
System.Web.UI.HtmlControls.HtmlInputRadioButton
Private Sub Page_Load(...)
RadioButtonList_categories_9.Attributes.Add("onChange",
"toggle('categoryOther');")
End Sub
--------------------------------------
It doesn't work (Object reference not set to an instance of an object)
Now, I know my problem (I think). The issue is that the ID
'RadioButtonList_categories_9' isn't actually exposed in the HTML until the
page is rendered. Does that sound like the problem?
If so, can anyone recommend a way to accomplish this? I'd like to do it via
javascript, but I don't see a way to target a specific asp:listitem if the
ID doesn't appear until after page rendering.
-Darrel
text field to appear.
I tried using an ONCHANGE event via the codebehind, but couldn't get that to
work. Plus, I'm thinking that might not be the most accessible way to handle
this anyways.
So...I wanted to just attach a javascript event to the specific listitem and
have that toggle the visibility of the text field (wrapped in a span).
I have this on my codebehind:
--------------------------------------
Protected WithEvents RadioButtonList_categories_9 As
System.Web.UI.HtmlControls.HtmlInputRadioButton
Private Sub Page_Load(...)
RadioButtonList_categories_9.Attributes.Add("onChange",
"toggle('categoryOther');")
End Sub
--------------------------------------
It doesn't work (Object reference not set to an instance of an object)
Now, I know my problem (I think). The issue is that the ID
'RadioButtonList_categories_9' isn't actually exposed in the HTML until the
page is rendered. Does that sound like the problem?
If so, can anyone recommend a way to accomplish this? I'd like to do it via
javascript, but I don't see a way to target a specific asp:listitem if the
ID doesn't appear until after page rendering.
-Darrel