none
how to display radio button valve RRS feed

  • Question

  • 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 the so it will save the radio button valve?

    • Moved by Reed KimbleMVP Thursday, March 1, 2018 3:15 AM asp.net in vb language
    Wednesday, February 28, 2018 7:58 PM

All replies

  • This looks like as ASP.Net Web Forms application.  For that, please visit https://forums.asp.net/

    You'll need to ensure you are following the correct page flow and data access model that those are specific to Web Forms projects.


    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Wednesday, February 28, 2018 8:17 PM
  • Hi Imran1234,

    According to your description, you just want to display radio button value, and insert this value into database. RadioButton.Checked Property indicate whether the control is checked, if the check box is checked, the value is true, otherwise false.

     Dim ischeck As Boolean = RadioButton1.Checked

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, March 1, 2018 2:23 AM