Professional Web Applications Themes

am i missing something simple asp:checkbox - Dreamweaver AppDev

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 ...

  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. #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.PInt32(String s, NumberStyles style, NumberFormatInfo
    info)
    at System.Int16.P(String s, NumberStyles style, IFormatProvider
    provider)
    at System.Int16.P(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" <fdsgsdgf.com> wrote in message
    news:d0ejoe$9pd$1forums.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

Similar Threads

  1. Links missing/update dialog missing upon file open
    By richarde@adobeforums.com in forum Adobe Indesign Macintosh
    Replies: 4
    Last Post: October 5th, 08:07 PM
  2. Replies: 4
    Last Post: June 13th, 02:29 AM
  3. Replies: 0
    Last Post: February 17th, 08:46 PM
  4. Simple checkbox population from Access
    By Jeremy in forum ASP Database
    Replies: 1
    Last Post: January 6th, 06:55 AM
  5. Simple Checkbox Question
    By Mary in forum Microsoft Access
    Replies: 3
    Last Post: July 22nd, 05:09 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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