selecting the items from dynamically generated radion button list controls
-
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?
-
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?
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"
-
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?
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
-
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
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.
-
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?
foreach (anItem as ListItem in rbCAction.Items)
{
if (anItem.Selected)
{
//Do something with it.
}
}