Dynamic Radiobuttonlist

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vegtard
    New Member
    • May 2007
    • 7

    Dynamic Radiobuttonlist

    Hi.

    I'm trying to make a dynamic radiobuttonlist for my site. I've found the code for it by googling and i get how its done, but i cant see to get my references working. I've added the System.Windows. Forms reference, and "using" at the top of the page. (some more googling told me that that was the appropriate reference) but i'm still getting this error message:

    The type or namespace name `RadioButtonLis t' could not be found. Are you missing a using directive or an assembly reference?(CS02 46)

    Heres the code for the radiobuttonlist :
    Code:
    //create dynamic radiobuttonlist 
    RadioButtonList rblTest = new RadioButtonList(); 
    rdoMoreRooms.ID = "rblTest";
    rdoMoreRooms.AutoPostBack = true; 
    //rdoMoreRooms.SelectedIndexChanged += new System.EventHandler(this.radioButton_Check_Changed); 
    rdoMoreRooms.RepeatDirection = RepeatDirection.Horizontal; 
    rdoMoreRooms.Items.Add(new ListItem("Cake", "Cake")); 
    phMoreRooms.Controls.Add(rblTest); 
    phMoreRooms.Controls.Add(new LiteralControl("<p>"));
    I've tried to find a tutorial for this, but it seems to be impossible to find. So i'm hoping that someone here knows how to do it :)
  • IanWright
    New Member
    • Jan 2008
    • 179

    #2
    Originally posted by vegtard
    Hi.

    I'm trying to make a dynamic radiobuttonlist for my site. I've found the code for it by googling and i get how its done, but i cant see to get my references working. I've added the System.Windows. Forms reference, and "using" at the top of the page. (some more googling told me that that was the appropriate reference) but i'm still getting this error message:

    The type or namespace name `RadioButtonLis t' could not be found. Are you missing a using directive or an assembly reference?(CS02 46)

    Heres the code for the radiobuttonlist :
    Code:
    //create dynamic radiobuttonlist 
    RadioButtonList rblTest = new RadioButtonList(); 
    rdoMoreRooms.ID = "rblTest";
    rdoMoreRooms.AutoPostBack = true; 
    //rdoMoreRooms.SelectedIndexChanged += new System.EventHandler(this.radioButton_Check_Changed); 
    rdoMoreRooms.RepeatDirection = RepeatDirection.Horizontal; 
    rdoMoreRooms.Items.Add(new ListItem("Cake", "Cake")); 
    phMoreRooms.Controls.Add(rblTest); 
    phMoreRooms.Controls.Add(new LiteralControl("<p>"));
    I've tried to find a tutorial for this, but it seems to be impossible to find. So i'm hoping that someone here knows how to do it :)
    The easiest way to add using statements (if you are using visual studio) is to use the context menu or right click and select Resolve. If the correct DLL is there it will automatically give you a list of all the namespaces that the class exists in.

    If you're not sure on the namespace, a quick google on the class name should return the namespace, or just use the MSDN site directly. What you'll find is that the RadioButtonList is actually contained in the System.Web.UI.W ebControls namespace.

    Comment

    • Rajkapoor
      New Member
      • Dec 2009
      • 1

      #3
      C# Windows Application Radiobutton

      Radiobuttonlist in c#....

      I have created form with 4 radio buttons.I have choose only one radio button.When i click radio button, the selected value is stored in database.How to write code in c#? In ASP.net one control is available called radiobuttonlist .But in windows application radiobuttonlist not available?

      please send me coding?

      m.rajkapoor@gma il.com

      Comment

      Working...