hiii friends i am developing a windows application in c#,in that i have 2 radio buttons named male and female.....how to insert the selected value to my database.........
any help is very much appreciated
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kirtan PatelPosted Dec 25, 2009, 7:26 AM
its Simple to Store Radio Button Value In SQL server take Bit Data type to store the value of Radio Button in to Database
Now if Bit = 1 then male and Bit=0 then female .
in coding
int x ;
if ( RadioButton1.Checked == true)
{
x = 1;
}
else if(RadioButton2.Checked == true)
{
x=0;
}
// Now Use X in Insert Statement to fill the value of that Bit Column :)
manoj kumarPosted Dec 27, 2009, 12:56 AM
string a;
if(RadioButton1.Checked==true)
{
a="Female";
}
else if(RadioButton2.Checked==true)
{
a="Male";
}
And in SourceCode
<asp:RadioButton ID="RadioButton1" runat="server" GroupName="a" Text="Female" />
<asp:RadioButton ID="RadioButton2" runat="server" GroupName="a" Text="Male" />