update checkbox values from gridview to database table.

Discussion in 'ASP .Net' started by hazz, May 3, 2006.

  1. hazz

    hazz Guest

    What do I do to capture the checkbox values as listed below in order to
    update the database table. There will be an ID field also contained in the
    row to use in the update query. What would I put in the Button Click event?
    Thank you. -Greg

    <tr>
    <td>CO_NUMBER</td><td>
    <input id="ItemsGrid_ctl02_CheckBox1" type="checkbox"
    name="ItemsGrid$ctl02$CheckBox1" checked="checked" />
    </td>
    </tr><tr>
    <td>CUST_ID</td><td>
    <input id="ItemsGrid_ctl03_CheckBox1" type="checkbox"
    name="ItemsGrid$ctl03$CheckBox1" />
    </td>
    </tr>

    protected void Button1_Click(object sender, EventArgs e)
    {
    Request.Form["??????"];
    }
     
    hazz, May 3, 2006
    #1
    1. Advertising

  2. hazz

    hazz Guest

    Looks like this will give me something to start with;

    int loop1;
    NameValueCollection coll;
    //Load Form variables into NameValueCollection variable.
    coll=Request.Form;
    // Get names of all forms into a string array.
    String[] arr1 = coll.AllKeys;
    for (loop1 = 0; loop1 < arr1.Length; loop1++)
    {
    Response.Write("Form: " + arr1[loop1] + "<br>");



    "hazz" <hazz@sonic_net> wrote in message
    news:...
    > What do I do to capture the checkbox values as listed below in order to
    > update the database table. There will be an ID field also contained in the
    > row to use in the update query. What would I put in the Button Click
    > event? Thank you. -Greg
    >
    > <tr>
    > <td>CO_NUMBER</td><td>
    > <input id="ItemsGrid_ctl02_CheckBox1" type="checkbox"
    > name="ItemsGrid$ctl02$CheckBox1" checked="checked" />
    > </td>
    > </tr><tr>
    > <td>CUST_ID</td><td>
    > <input id="ItemsGrid_ctl03_CheckBox1" type="checkbox"
    > name="ItemsGrid$ctl03$CheckBox1" />
    > </td>
    > </tr>
    >
    > protected void Button1_Click(object sender, EventArgs e)
    > {
    > Request.Form["??????"];
    > }
    >
     
    hazz, May 3, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike

    update checkbox values

    Mike, Jun 2, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    5,931
    Steven Cheng[MSFT]
    Jun 3, 2004
  2. hazz
    Replies:
    0
    Views:
    808
  3. stavo23
    Replies:
    0
    Views:
    2,176
    stavo23
    Feb 26, 2008
  4. Joey Pang
    Replies:
    4
    Views:
    539
    Joey Pang
    Jun 13, 2005
  5. randy
    Replies:
    13
    Views:
    461
    Tad McClellan
    Nov 1, 2003
Loading...

Share This Page