locked
get checkbox value RRS feed

  • Question

  • User-1696758683 posted

    Hi all......

    I am now creating a mobile project using vb.net........but i dunno how to get the value of the checkbox....

    my checkbox is like this

    <mobile:SelectionList ID="slFinishing" Runat="server" SelectType="CheckBox">

    <Item Text="Tick if punch hole required" Value="1" />

    </mobile:SelectionList>

    ...... and at the code behind.....how can i get the value of this checkbox....(to know whether it is checked) .....

    Can someone pls giv me some suggestion regarding this ......

    Thanks

    Monday, September 17, 2007 3:35 AM

Answers

  • User1191518856 posted

    Wrap it with a null check for the Selection:

    if (slFinishing.Selection != null)
    {
      string value = slFinishing.Selection.Value;
    }
    else
    {
      // no value selected
    }
      
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 18, 2007 7:09 AM

All replies

  • User1191518856 posted

     You should be able to check slFinishing.Selection.Value?

    Monday, September 17, 2007 6:01 AM
  • User-1696758683 posted

    erm.........it can get its value by using slFinishing.Selection.Value when the checkbox is checked, but it return me error when it is uncheck....

    Thanks

    Monday, September 17, 2007 8:36 PM
  • User1191518856 posted

    Wrap it with a null check for the Selection:

    if (slFinishing.Selection != null)
    {
      string value = slFinishing.Selection.Value;
    }
    else
    {
      // no value selected
    }
      
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 18, 2007 7:09 AM
  • User-1696758683 posted

    hi johram

    Thanks for ur solution, i will try to look at it.....

     

    Tuesday, September 18, 2007 8:39 PM