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

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

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

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.