Tech Off Thread

3 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

How can I work with the broken radio button in asp.net 2.0?

Back to Forum: Tech Off
  • User profile image
    qwert231

    With Asp.Net 1.0/1.1 I could use value in an ASP:RadioButton control. But no more.


    I can't even use Request.Form("GroupName") because they screwed up the GroupName of the radio buttons. (When you use Master Pages that is. And that's the main reason I went to .Net 2.0)

    I liked using the value, because my web developer could change the value if necessary in the page, without having to recompile the code behind.

  • User profile image
    Ang3lFir3

    Have you tried using a RadioButtonList and using RadioButtonList.SelectedValue() ?

    As I am getting you are wanting to retrieve the value of the selected RadioButton.

  • User profile image
    Sven Groot

    qwert231 wrote:
    I can't even use Request.Form("GroupName") because they screwed up the GroupName of the radio buttons. (When you use Master Pages that is. And that's the main reason I went to .Net 2.0)

    That's intentional. Just like with user controls, master pages create a new naming context so the actual name (and id) sent to the client will be composed of the ID of the server control and all its naming containers. It's to prevent naming conflicts between controls on the master page and the page that uses it. Since the name is always the same (it tends to be something like ctl00$ContentPlaceholder1$RadiobuttonGroupname) you can just use that. You can also determine it by doing "radioButton.NamingContainer.UniqueID & Page.IdSeparator & radioButton.GroupName" (note that that may not work if the radiobutton is part of a radiobuttonlist).

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.