am i missing something simple asp:checkbox

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default am i missing something simple asp:checkbox

    Hi

    I have a table in my db which basically stores users preferences as either a
    1 or 0 (sql server tinyInt)
    I built the insert page using MM Insert and standard checkbox with the
    checked value set to 1, I had to manually change the default value set in
    the insert paramaters to 0 to ensure I got either a 0 entered into db if
    unchecked.

    The problem I have now is on the update preferences page, the existing prefs
    are loaded via a dataset and the update form wizard creates 50 checkboxes.

    The problem I seem to have is that the asp:checkbox doesn't appear to have a
    checked value so when I submit the form I get error converting to int.

    I built a limited form with only 2 checkboxes and using the on pre-inserted
    event, used:
    dim myVar, myVar1
    sub update1_onPreInsert()
    if chbTest.Checked = True then
    myVar = 1
    Else
    myVar= 0
    End If
    if chbTest.Checked = True then
    myVar1 = 1
    Else
    myVar1= 0
    End If
    and used the variables as parameters for the update all is well. I have
    around 50 checkboxes on the page so the code will be a bit of a nightmare if
    the above is the only way to do it.
    As I am using the <%# IIf((dsGetConfig.FieldValue("cantravel", Container) =
    "1"), "checked", "") %> I can't use the standard checkbox.

    In short is there an easy way to ensure the checked value of an asp:checkbox
    is 1


    ossie Guest

  2. Similar Questions and Discussions

    1. Links missing/update dialog missing upon file open
      I am experiencing a strange problem when opening files with InDesign CS2. The usaul dialog box alerting you to missing/updated links does not appear....
    2. Howto bind CheckBox to the datagrid/ Then update the database field when the checkbox is clicked.
      I am trying to update the database field when the checkbox is clicked. I am trying to modified the following solution but.. got stuck on the...
    3. missing guides. missing cursors. missing a good drawing app. Ugh.
      I can't see my text cursor. It's invisible. Why? I can't see new guides I drag onto the documents. They are there, I just can't see them. Why? ...
    4. Simple checkbox population from Access
      I am trying to populate a list of between 5-10 items which will be drawn from an Access Table to a form wherein the visitor can check boxes of each...
    5. Simple Checkbox Question
      Hello, I have a checkbox on a form (i know very little about checkboxes) and I wanted it to be unchecked, so i set triple state to yes. Although...
  3. #2

    Default Re: am i missing something simple asp:checkbox

    OK
    I tried adding
    checkbox1.attributes.add("Value", 1) to the page load event but still get
    the following error
    System.FormatException: Input string was not in a correct format.
    at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo
    info)
    at System.Int16.Parse(String s, NumberStyles style, IFormatProvider
    provider)
    at System.Int16.Parse(String s)
    at DreamweaverCtrls.DataSet.ConvertParameterValue(Str ing strValue, Enum
    theType)
    at DreamweaverCtrls.DataSet.AddParameters(IDbCommand myCommand)
    at DreamweaverCtrls.DataSet.DoInit()

    Not the most helpfull of error messages and the stack trace does not reveal
    any errors at all

    when I look at the page source I notice that the value is not being assigned
    to the checkbox

    Any help gratefully received


    "ossie" <fdsg@sdgf.com> wrote in message
    news:d0ejoe$9pd$1@forums.macromedia.com...
    > Hi
    >
    > I have a table in my db which basically stores users preferences as either
    > a 1 or 0 (sql server tinyInt)
    > I built the insert page using MM Insert and standard checkbox with the
    > checked value set to 1, I had to manually change the default value set in
    > the insert paramaters to 0 to ensure I got either a 0 entered into db if
    > unchecked.
    >
    > The problem I have now is on the update preferences page, the existing
    > prefs are loaded via a dataset and the update form wizard creates 50
    > checkboxes.
    >
    > The problem I seem to have is that the asp:checkbox doesn't appear to have
    > a checked value so when I submit the form I get error converting to int.
    >
    > I built a limited form with only 2 checkboxes and using the on
    > pre-inserted event, used:
    > dim myVar, myVar1
    > sub update1_onPreInsert()
    > if chbTest.Checked = True then
    > myVar = 1
    > Else
    > myVar= 0
    > End If
    > if chbTest.Checked = True then
    > myVar1 = 1
    > Else
    > myVar1= 0
    > End If
    > and used the variables as parameters for the update all is well. I have
    > around 50 checkboxes on the page so the code will be a bit of a nightmare
    > if the above is the only way to do it.
    > As I am using the <%# IIf((dsGetConfig.FieldValue("cantravel", Container)
    > = "1"), "checked", "") %> I can't use the standard checkbox.
    >
    > In short is there an easy way to ensure the checked value of an
    > asp:checkbox is 1
    >

    ossie Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139