I have created USERNAME,EMALE,PASSWORD,GENDER,(MALE,FEMALE,OTHERS as radiobutton) and COUNTRY(contry list as dropdownlist)
USERNAME,EMALE,PASSWORD is geting inserted but radiobutton value is not .
I dont know how to insert the radiobutton vale into databse and what will be the datatype i should choose.
I am using using -Oracle.ManagedDataAccess.Client;
-.net framework 4.5
-C#
I am adding my code so that you will have an idea till what i have progressed.
<td class="auto-style2">GENDER</td>
<td class="auto-style8">
<asp:RadioButton ID="MALE" runat="server" GroupName="gender" Text="MALE" />
<asp:RadioButton ID="FEMALE" runat="server" GroupName="gender" Text="FEMALE" />
<asp:RadioButton ID="OTHERS" runat="server" GroupName="gender" Text="OTHERS" />
</td>
<td class="auto-style2">COUNTRY</td>
<td class="auto-style8">
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>Afghanistan</asp:ListItem>
<asp:ListItem>Albania</asp:ListItem>
<asp:ListItem>Algeria</asp:ListItem>
</asp:DropDownList>
</td>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Oracle.ManagedDataAccess.Client;
namespace WebApplication6
{
public partial class registration : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
try
{
OracleConnection con = new OracleConnection("user id= module1;password=123;data source=localhost:1521/xe");
con.Open();
Response.Write("connected");
OracleCommand cmd = new OracleCommand("insert into TEST1(USERNAME,PASSWORD,EMAIL) values" + "(:USERNAME,:PASSWORD,:EMAIL)", con);
cmd.Parameters.Add(":USERNAME", TextBox1.Text);
cmd.Parameters.Add(":PASSWORD", TextBox2.Text);
cmd.Parameters.Add(":EMAIL", TextBox4.Text);
int i = cmd.ExecuteNonQuery();
con.Close();
}
catch (Exception ex)
{
Response.Write("" + ex);
}
Label1.Text = "Registration Successful";
}
}
protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
{
args.IsValid = this.recaptcha.IsValid;
}
}
}