I have two radio buttons Male and Female.
i m storing those data in database using Insert query.
Now i have to select particular radio button based on gridview row.
Width="787px"> EmptyDataText="No Records found !!" ForeColor="#333333" GridLines="None" Height="289px" ondatabound="gvNewRegistration_DataBound" onprerender="gvNewRegistration_PreRender" onrowcommand="gvNewRegistration_RowCommand" onselectedindexchanged="gvNewRegistration_SelectedIndexChanged" ShowFooter="True" Width="414px"> Position="Top" PreviousPageText="Previous" /> SelectCommand="SELECT [Title],[Patient_Name],[Street],[City],[State],[Country],[Zip_Code],[Phone_1],[Phone_2],[Mobile_Number],[Ward],[ISDischarged],[MR_Number],[HospitalNo],[Ward_ID],[Patient_Type],[Sex],[Date_Admitted],[tinYear],[tinMonth],[tinDays],[BillType],[RefBy],[CorporateCode],[PackageCode],[InsuranceCode],[VisitCode] FROM [registration_details] ORDER BY [MR_Number]" protected void gvNewRegistration_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Select") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow gvRow = gvNewRegistration.Rows[index]; cmdAdd.Enabled = false; cmdDelete.Enabled = true; cmdModify.Enabled = true; cmdCancel.Enabled = true; string CName; string Pname; string Iname; if (e.CommandSource == "Male") { int rowIndex = int.Parse(e.CommandArgument.ToString()); rbMale.Checked = true; } else if (e.CommandSource == "Female") { int rowIndex = int.Parse(e.CommandArgument.ToString()); rbFemale.Checked = true; } else { rbMale.Checked = false; rbFemale.Checked = false; } if (e.CommandSource == "IP") { int rowIndex = int.Parse(e.CommandArgument.ToString()); rbIP.Checked = true; } else if (e.CommandSource == "OP") { int rowIndex = int.Parse(e.CommandArgument.ToString()); rbOP.Checked = true; } else if (e.CommandSource == "Direct") { int rowIndex = int.Parse(e.CommandArgument.ToString()); rbDirect.Checked = true; } else { rbIP.Checked = false; rbOP.Checked = false; rbDirect.Checked = false; } } protected void Display_Record(string strCode) { string strSQL; string dbConn = ConfigurationManager.ConnectionStrings["CMC"].ConnectionString; SqlConnection sqlConn = new SqlConnection(dbConn); sqlConn.Open(); // strSQL = "SELECT [Patient_Type],[HospitalNo],[MR_Number],[Title],[Sex],[BillType],[Date_Admitted],[Street],[City],[State],[Country],[Zip_Code],[Phone_1],[Phone_2],[Mobile_Number],[tinYear],[tinMonth],[tinDays],[CorporateCode],[PackageCode],[InsuranceCode],[Ward],[RefBy] FROM [registration_details] Where [Patient_Name]='" + strCode + "'"; strSQL = "select Title,Patient_Name,Street,City,State,Country,Zip_Code,Phone_1,Phone_2,Mobile_Number,MR_Number,Ward,Patient_Type,Sex,Date_Admitted,tinMonth,tinYear,tinDays,BillType,RefBy,CorporateCode,PackageCode,InsuranceCode FROM [registration_details] Where [HospitalNo]='" + strCode + "'"; SqlCommand cmdRegistration = new SqlCommand(strSQL, sqlConn); SqlDataReader drRegistration = cmdRegistration.ExecuteReader(); while (drRegistration.Read()) { txtPatientName.Text = drRegistration[1].ToString(); } .... i used like above coding...but it is not working...Help me pls.... |
Replies
Know the answer? Post it — somebody with the same question will find it here.