Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Dynamiclly radiobuttonlist

Dynamiclly radiobuttonlist

Scheduled Pinned Locked Moved ASP.NET
designhelp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Burim Rama
    wrote on last edited by
    #1

    Hey I have created a metode to create RadiobuttonList dynamically but when i show it in my page end i chec them to false or true and when i click the button all radiobutton is coming back to true. I have a function to read wgat user have selected : Hope i can help. her is som code to create radiobuttonlist: foreach (DataRow dr in ds.Tables[0].Rows) { Label li = new Label(); System.Web.UI.WebControls.ListItem ls = new System.Web.UI.WebControls.ListItem(); RadioButtonList rl = new RadioButtonList(); rl.Items.Add(new System.Web.UI.WebControls.ListItem("Inkl", dr["Type"].ToString())); rl.Items.Add(new System.Web.UI.WebControls.ListItem("Eks", dr["Type"].ToString())); rl.RepeatDirection = RepeatDirection.Horizontal; Panel2.Controls.Add(li); Panel2.Controls.Add(rl); //tilføjer dem til panelet } then when i click a button hwo called checkthevalue, i called this metode: foreach (Control cr in Panel2.Controls) { if (cr is RadioButtonList) { RadioButtonList rb = (RadioButtonList)cr; foreach (System.Web.UI.WebControls.ListItem ls in rb.Items) { if (ls.Selected && rb.SelectedItem.Text == "Eks") { //this ad a line to pdf file document.Add(new Paragraph("-" + rb.SelectedItem.Value.ToString(), FontFactory.GetFont(FontFactory.TIMES_ROMAN, 12))); } } } } Hope i can help me.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups