protected Sub Submit_Click(sender As Object, e As EventArgs) Handles Submit.Click
Dim Billpp As String = String.Empty
If rbYes.Checked Then
Billpp = "Y"
ElseIf rbNo.Checked Then
Billpp = "N"
End If
Dim constr As String = ConfigurationManager.ConnectionStrings("Cong").ConnectionString
Using con As New SqlConnection(constr)
Using cmd As New SqlCommand("INSERT INTO Tbillpp(Billpp,ClaimID,JobID) VALUES(@Billpp,@ClaimID,@JobID)")
cmd.Connection = con
cmd.Parameters.AddWithValue("@Billpp", Billpp)
cmd.Parameters.AddWithValue("@ClaimID", Request.QueryString("ClaimID"))
cmd.Parameters.AddWithValue("@JobID", Request.QueryString("JobID"))
con.Open()
cmd.ExecuteNonQuery()
con.Close()
End Using
End Using
End Sub
End Class
how can I change the code so it deplays the current radio button valve?
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Response.Write(YesNo.SelectedItem.Value.ToString())
End Sub
Result:
Best Regards,
Brando
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
26 Points
49 Posts
Vb.net question
Feb 28, 2018 09:08 PM|MOHIIMRAN|LINK
Dim Billpp As String = String.Empty
If rbYes.Checked Then
Billpp = "Y"
ElseIf rbNo.Checked Then
Billpp = "N"
End If
Dim constr As String = ConfigurationManager.ConnectionStrings("Cong").ConnectionString
Using con As New SqlConnection(constr)
Using cmd As New SqlCommand("INSERT INTO Tbillpp(Billpp,ClaimID,JobID) VALUES(@Billpp,@ClaimID,@JobID)")
cmd.Connection = con
cmd.Parameters.AddWithValue("@Billpp", Billpp)
cmd.Parameters.AddWithValue("@ClaimID", Request.QueryString("ClaimID"))
cmd.Parameters.AddWithValue("@JobID", Request.QueryString("JobID"))
con.Open()
cmd.ExecuteNonQuery()
con.Close()
End Using
End Using
End Sub
End Class
how can I change the code so it deplays the current radio button valve?
All-Star
53691 Points
24028 Posts
Re: Vb.net question
Feb 28, 2018 09:40 PM|mgebhard|LINK
The way the code is written it appears you have two different radio button. You should use a radio button list.
Star
9831 Points
3120 Posts
Re: Vb.net question
Mar 01, 2018 02:27 AM|Brando ZWZ|LINK
Hi MOHIIMRAN,
As mgebhard says, I suggest you could try to use radiobutton list.
If you use two radio button, we could select both two button.
More details, you could refer to below codes:
Codebehind:
Result:
Best Regards,
Brando