Professional Web Applications Themes

Checkboxes in a datagrid - ASP.NET General

Jeremy, If you want the checkboxes to auto post back I have sample code on how to do so on my website, www.aboutfortunate.com. Just search for: "checkboxes in datagrid" or something like that. Sincerely, -- S. Justin Gengo, MCP Web Developer Free code library at: www.aboutfortunate.com "Out of chaos comes order." Nietzche "Jeremy" <com> wrote in message news:03c001c36296$d47045d0$gbl... ...

  1. #1

    Default Re: Checkboxes in a datagrid

    Jeremy,

    If you want the checkboxes to auto post back I have sample code on how to do
    so on my website, www.aboutfortunate.com. Just search for: "checkboxes in
    datagrid" or something like that.

    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzche


    "Jeremy" <com> wrote in message
    news:03c001c36296$d47045d0$gbl... 


    S. Guest

  2. #2

    Default Re: Checkboxes in a datagrid

    Thanks for the reply, however I don't exactly want an auto
    post back when a user selects a checkbox.

    The following is the code I put in my button click event.
    In trying to get it work I'm just writing out what what
    checked, however it always tells me nothing was checked.

    Dim DataGridItem As DataGridItem
    Dim Purchase As WebControls.CheckBox
    For Each DataGridItem In Update_Datagrid.Items
    Purchase = DataGridItem.FindControl
    ("Purchase_checkbox")
    If Purchase.Checked Then
    Response.Write(DataGridItem.FindControl
    ("item"))
    Response.Write("<br>")
    Else
    Response.Write("none were checked<br>")
    End If
    Next

     
    sample code on how to do 
    for: "checkboxes in [/ref]
    now [/ref]
    checked? 
    >
    >
    >.
    >[/ref]
    Jeremy Guest

  3. #3

    Default Re: Checkboxes in a datagrid


    "Jeremy" <com> wrote in message
    news:0c3601c3629c$98358390$gbl... 

    OK so use a bicycle_postback when the user selects a radio button.


    Guenther Guest

  4. #4

    Default Re: Checkboxes in a datagrid

    That would work except I'm not using radio buttons because
    my speakers are broken.

     [/ref]
    auto 
    >
    >OK so use a bicycle_postback when the user selects a[/ref]
    radio button. 
    Jeremy Guest

  5. #5

    Default Re: Checkboxes in a datagrid

    ROTFLMAO


    "Jeremy" <com> wrote in message
    news:061601c362a1$73f30930$gbl... [/ref]
    > auto 
    > >
    > >OK so use a bicycle_postback when the user selects a[/ref]
    > radio button. [/ref]


    Guenther Guest

  6. #6

    Default Re: Checkboxes in a datagrid

    Jeremy,

    Here's an interesting behaviour. I was just experimenting.

    I set a project up quickly to test with and therefore added a templated
    checkbox column but was autogenerating all the other columns. None of the
    checkboxes I would select would show up as selected. Then I turned
    autogenerate columns off. It works!

    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzche


    "Jeremy" <com> wrote in message
    news:0c3601c3629c$98358390$gbl... 
    > sample code on how to do 
    > for: "checkboxes in [/ref]
    > now [/ref]
    > checked? 
    > >
    > >
    > >.
    > >[/ref][/ref]


    S. Guest

  7. #7

    Default Re: Checkboxes in a datagrid

    As a followup I just tested the code from my code library that I mentioned
    earlier. It works just fine! Just remove the autopostback from the
    checkbox.

    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzche


    "S. Justin Gengo" <com> wrote in message
    news:u5$phx.gbl... 
    > > sample code on how to do 
    > > for: "checkboxes in 
    > > now 
    > > checked? [/ref]
    >
    >[/ref]


    S. Guest

  8. #8

    Default Re: Checkboxes in a datagrid

    Jeremy,

    I always insert the exact same if then and comments into my pageload to
    avoid just such a mistake:

    '---Every page load

    If Not IsPostBack Then
    '---First page load only

    Else
    '---Post back only

    End If

    '---Every page load

    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzche


    "Jeremy" <com> wrote in message
    news:0a0d01c3637a$e81e5dd0$gbl... 
    > that I mentioned 
    > autopostback from the 
    > message [/ref]
    > experimenting. [/ref]
    > added a templated [/ref]
    > columns. None of the [/ref]
    > Then I turned [/ref]
    > auto [/ref]
    > event. [/ref]
    > what [/ref]
    > checked. [/ref]
    > (DataGridItem.FindControl [/ref]
    > checked<br>") [/ref]
    > message [/ref]
    > to use [/ref]
    > each row [/ref]
    > next to [/ref]
    > to [/ref]
    > on each [/ref]
    > above. I've [/ref]
    > also [/ref]
    > but 
    > >
    > >
    > >.
    > >[/ref][/ref]


    S. Guest

Similar Threads

  1. Checkboxes in DataGrid are not submitting a value
    By brian in forum ASP.NET Data Grid Control
    Replies: 5
    Last Post: December 1st, 02:14 AM
  2. Checkboxes in Datagrid
    By Aaron in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: September 20th, 11:12 AM
  3. DataGrid with Checkboxes
    By dave in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: June 20th, 01:00 PM
  4. Checkboxes in a Datagrid problem
    By REB in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: March 1st, 05:17 PM
  5. Updating database through a datagrid using checkboxes
    By Matt Sogla in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: December 3rd, 02:45 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