hi all
i have astored procedure to update table,im using radio option control gender to select gender:
the table as below :
emp_id int,
emp_name nvarchar(50)
emp_gender nchar(10)
and the stored procedure to update this table is as below :
ALTER proc [dbo].[SP_EditEmpDetails]
@emp_id int,
@emp_name nvarchar(50),
@emp_gender nchar(10)
as
Begin
update tbl_Employee set Emp_Name= @Emp_Name,Emp_Gender=Emp_Gender
where emp_id=@emp_id
end
also
in the page is like below :
<table class="auto-style1">
<tr>
<td class="auto-style2">Employee Full Name :</td>
<td class="auto-style3">
<asp:TextBox ID="txtFullName" runat="server"></asp:TextBox>
</td>
<td class="auto-style3">
</td>
</tr>
<tr>
<td class="auto-style2">Gender:</td>
<td class="auto-style3">
<asp:RadioButton ID="rbMale" runat="server" Text="Male" GroupName="Gender" /></td>
<td class="auto-style3">
<asp:RadioButton ID="rdFemale" runat="server" GroupName="Gender" Text="Female" /></td>
<td> </td>
</tr>
</table>
and the code behind the page is like below :
protected void btnEdit_Click(object sender, EventArgs e)
{
Session["Grid_ID"] = gvEmpList.SelectedDataKey.Value;
SqlCommand cmd = con.CreateCommand();
cmd.CommandText = "SP_EditEmpDetails";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Emp_Name", txtFullName.Text);
cmd.Parameters.AddWithValue("@Emp_ID", Convert.ToInt32(Session["Grid_ID"]));
//cmd.Parameters.AddWithValue("@Emp_Gender", rbMale.Text);
con.Open();
SqlDataReader V = cmd.ExecuteReader();
lblmsg.Text = "employee updated!!";
con.Close();
}
how to handel the radio button in order to select and value go to the table ?
regards