0

Hi my name is Abdul munawar

I am using two optional radio buttons in asp.net front end,... but ui have store single option in databse.. wat is the coding to select single Like male or feemale 2) buy or sell

So i need to write the code for selecting value and to store in databse

Pls kindly help me in this process

4
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by sierrainfo
0

based on the column type for these radiobuttons u can send data to database.
For example if u have column of type bit ,u have to send 0/1.
if u have column type string ,u can send male/female

0

Actualy, here i am using 2 textbox and 2 radio buttons...
if iam writting code like insert into table values ("Textbox1text+"'. ........+"' whwt is the code to insert radio button value in ado.net using ASp.net c#.
Pls help me da

0

Actualy, here i am using 2 textbox and 2 radio buttons...
if iam writting code like insert into table values ("Textbox1text+"'. ........+"' whwt is the code to insert radio button value in ado.net using ASp.net c#.
Pls help me da

I think you should use RadioButtonList instead of RadioButton.

String SQL;
Byte gender;
if(RadioButtonList1.SelectedIndex==0)
{
     gender=0;
}
else
{
     gender=1;
}
SQL = "INSERT INTO TABLES VALUES ('" + TextBox1.Text + "', " + gender + ")";

Thanks,

Kusno.

0

You can also use this: RadioButton.GroupName Property

Use the GroupName property to specify a grouping of radio buttons to create a mutually exclusive set of controls. You can use the GroupName property when only one selection is possible from a list of available options.

When this property is set, only one RadioButton in the specified group can be selected at a time.

This topic is in MSDN with code.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.