Binding a Radiobuttonlist to a Database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Garudzo
    New Member
    • May 2007
    • 20

    Binding a Radiobuttonlist to a Database

    I am binding a radiobuttonlist to a data field in a database. If the field has a null value my application produces an error maybe because the null value wont be an item in the radio button list. What I want is the radiobuttonlist not to check any value if it is not in the list Please Help
  • sijugeo
    New Member
    • Jul 2007
    • 42

    #2
    Originally posted by Garudzo
    I am binding a radiobuttonlist to a data field in a database. If the field has a null value my application produces an error maybe because the null value wont be an item in the radio button list. What I want is the radiobuttonlist not to check any value if it is not in the list Please Help


    Validate the Input coming from database before assigning to the radiobuttonlist

    if(Value!="")
    {
    //Include the binding code here
    }

    Siju
    Last edited by Frinavale; Nov 5 '08, 02:55 PM. Reason: fixed quote

    Comment

    • Garudzo
      New Member
      • May 2007
      • 20

      #3
      Thanks for the advice but this assumes that I am doing the binding in code. In this case I just draged the control to a formview and set the databound property. Cant I do it without using code?

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Originally posted by Garudzo
        Thanks for the advice but this assumes that I am doing the binding in code. In this case I just draged the control to a formview and set the databound property. Cant I do it without using code?
        If you want to put custom validation on your data you will need to customize it using code.

        You can drag the RadioButtonList control onto your form...but you will have to customize the data source that you are binding it to.

        Comment

        Working...