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. selecting the items from dynamically generated radion button list controls

selecting the items from dynamically generated radion button list controls

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-netdatabase
5 Posts 4 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.
  • R Offline
    R Offline
    rameshdontagani
    wrote on last edited by
    #1

    hi, i am creating the radio button list controls dynamically.in the pageload event [CODE] for(i=0;i<3;i++) { RadioButtonList rbCAction=new RadioButtonList(); rbCAction.ID="rbCAction"+r; rbCAction.Font.Size=10; rbCAction.Font.Name="Verdana"; rbCAction.DataSource=dataSetList; rbCAction.DataTextField="answer"; rbCAction.DataValueField="id"; rbCAction.DataBind(); Panel1.Controls.Add(rbCAction); } [/CODE] along with this 3 radion button lists ..one button is there named "save". after clicking on the save button..wat are the values i have seleted from the radio button lists these values should be insetred in to the database..this is my requirement. for the button click event iw rote the code like this [CODE] for(k=0;k<3;k++) { rbCAction.ID="rbCAction1"+k; string str=rbCAction.SelectedValue; [/CODE] but in selected value it is showing that ...only last radio button list seleted item showing..for evey one . how can i insert these three radio button lists selected values in to databse using asp.net?

    A S P 3 Replies Last reply
    0
    • R rameshdontagani

      hi, i am creating the radio button list controls dynamically.in the pageload event [CODE] for(i=0;i<3;i++) { RadioButtonList rbCAction=new RadioButtonList(); rbCAction.ID="rbCAction"+r; rbCAction.Font.Size=10; rbCAction.Font.Name="Verdana"; rbCAction.DataSource=dataSetList; rbCAction.DataTextField="answer"; rbCAction.DataValueField="id"; rbCAction.DataBind(); Panel1.Controls.Add(rbCAction); } [/CODE] along with this 3 radion button lists ..one button is there named "save". after clicking on the save button..wat are the values i have seleted from the radio button lists these values should be insetred in to the database..this is my requirement. for the button click event iw rote the code like this [CODE] for(k=0;k<3;k++) { rbCAction.ID="rbCAction1"+k; string str=rbCAction.SelectedValue; [/CODE] but in selected value it is showing that ...only last radio button list seleted item showing..for evey one . how can i insert these three radio button lists selected values in to databse using asp.net?

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      while creating Radion, add event handler to all created object and deleget the bethod !!!!

      Best Regards ----------------- Abhijit Jana View My Latest Article :- SpyNet : Your Network Spy "Success is Journey it's not a destination"

      1 Reply Last reply
      0
      • R rameshdontagani

        hi, i am creating the radio button list controls dynamically.in the pageload event [CODE] for(i=0;i<3;i++) { RadioButtonList rbCAction=new RadioButtonList(); rbCAction.ID="rbCAction"+r; rbCAction.Font.Size=10; rbCAction.Font.Name="Verdana"; rbCAction.DataSource=dataSetList; rbCAction.DataTextField="answer"; rbCAction.DataValueField="id"; rbCAction.DataBind(); Panel1.Controls.Add(rbCAction); } [/CODE] along with this 3 radion button lists ..one button is there named "save". after clicking on the save button..wat are the values i have seleted from the radio button lists these values should be insetred in to the database..this is my requirement. for the button click event iw rote the code like this [CODE] for(k=0;k<3;k++) { rbCAction.ID="rbCAction1"+k; string str=rbCAction.SelectedValue; [/CODE] but in selected value it is showing that ...only last radio button list seleted item showing..for evey one . how can i insert these three radio button lists selected values in to databse using asp.net?

        S Offline
        S Offline
        Sun Rays
        wrote on last edited by
        #3

        beklo.com/rameshgoudd wrote:

        for(k=0;k<3;k++) { rbCAction.ID="rbCAction1"+k; string str=rbCAction.SelectedValue;

        What you are getting here in str string ? put debug button here at this point,

        beklo.com/rameshgoudd wrote:

        string str=rbCAction.SelectedValue;

        Hope it will help you.

        Thanks, Sun Rays To get something you must have to try once. My Articles

        R 1 Reply Last reply
        0
        • S Sun Rays

          beklo.com/rameshgoudd wrote:

          for(k=0;k<3;k++) { rbCAction.ID="rbCAction1"+k; string str=rbCAction.SelectedValue;

          What you are getting here in str string ? put debug button here at this point,

          beklo.com/rameshgoudd wrote:

          string str=rbCAction.SelectedValue;

          Hope it will help you.

          Thanks, Sun Rays To get something you must have to try once. My Articles

          R Offline
          R Offline
          rameshdontagani
          wrote on last edited by
          #4

          hi , i am getting the id of selected item of last radio button list..but i need all ids of the three radio button lists selected item.

          1 Reply Last reply
          0
          • R rameshdontagani

            hi, i am creating the radio button list controls dynamically.in the pageload event [CODE] for(i=0;i<3;i++) { RadioButtonList rbCAction=new RadioButtonList(); rbCAction.ID="rbCAction"+r; rbCAction.Font.Size=10; rbCAction.Font.Name="Verdana"; rbCAction.DataSource=dataSetList; rbCAction.DataTextField="answer"; rbCAction.DataValueField="id"; rbCAction.DataBind(); Panel1.Controls.Add(rbCAction); } [/CODE] along with this 3 radion button lists ..one button is there named "save". after clicking on the save button..wat are the values i have seleted from the radio button lists these values should be insetred in to the database..this is my requirement. for the button click event iw rote the code like this [CODE] for(k=0;k<3;k++) { rbCAction.ID="rbCAction1"+k; string str=rbCAction.SelectedValue; [/CODE] but in selected value it is showing that ...only last radio button list seleted item showing..for evey one . how can i insert these three radio button lists selected values in to databse using asp.net?

            P Offline
            P Offline
            Paddy Boyd
            wrote on last edited by
            #5

            foreach (anItem as ListItem in rbCAction.Items)
            {
            if (anItem.Selected)
            {
            //Do something with it.
            }
            }

            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