update checkbox values from gridview to database table.

H

hazz

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["??????"];
}
 
H

hazz

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>");
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top