472,784 Members | 945 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,784 software developers and data experts.

selection via checkboxlist in gridview

hi all,

i have a grid view and i have inserted a checboxlist template with 5checkboxes per row into the gridview. i want the user to be able to select an option (A-E) and that selected option be saved somehow because later on, the selected option will be compared with values from another table. this is possible right?

Sep 17 '07 #1
2 1949
hi all,
i have a checxboxlist in my gridview. i want the user to tick an option and the ticked option to be saved to my database. i have gone this far
Expand|Select|Wrap|Line Numbers
  1.   protected void Button1_Click(object sender, EventArgs e)
  2.     {
  4.         Response.Redirect("Direction2.aspx");
  5.         foreach ( GridViewRow row in GridView1.Rows) 
  6.         {
  7.             CheckBoxList checkboxlist = (CheckBoxList)row.FindControl("chklist");
  8.             if (checkboxlist != null  )
  9.             {
  10.                 foreach (ListItem litem in checkboxlist.Items)
  11.                 {
  12.                     if (litem.Selected)
  13.                     {
  14.                       // THIS IS WHERE THE PROBLEM IS!
  15.                     } 
  16.                 }
  17.             }
  18.         }
  19.     }
What code do i use to save the selected items to my database?
when i created my table in my database i did not include a checkboxlist column. i created my table using visual studio and i dont know how to include a checkboxlist in the table.

thanks guys!
Sep 25 '07 #2
4,871 Expert 4TB
You really need to learn the basics about databases. Why would you need a checkboxlist in your database when you are just going to insert the value? Take your values, connect to your database and insert or update them using sql.
Sep 25 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

by: rob | last post by:
Here is my scenario: One of my aspx pages has a CheckBoxList (Item1, Item2) and a GridView. Then I have a database that has the columns Item1 and Item2 (among others) with the data type bit....
by: Jensen bredal | last post by:
Hello, Can someone guide me in how i may process a multiple selection on a databound checkboxlist? The checkboxlist is bound to a table of product category. The product category id is an FK in...
by: Faybert | last post by:
Hello, and Thanks in advance for any light you might shed on my troubles. I'm trying to setup a series of checkboxes, or a checkboxlist to control the results that are shown on a gridview...
by: Jeppe Jespersen | last post by:
I basically have two controls on my form: A CheckboxList and a GridView. My gridView is bound to a sqlDataSource. In the dataSource's "where" clause, i specify that a parameter should equal the...
by: avital | last post by:
Hi, Hope someone can please help. I have a Gridview with a checkboxlist. On edititemTemplate I want the checkboxlist items to be selected as returned from the database. In the database I...
by: joebob8000 | last post by:
This seems like a simple task, but my 6 year old roots in classic ASP must be causing me trouble with my current problem. I am looking to provide a search for users in which they can select...
by: mutt1170 | last post by:
I have a checkbox list nested inside a gridview. The gridview pulls its data from an objectdatasource and lists countries. The nested checkbox list is databound to another object datasource and...
by: dbuchanan | last post by:
There are three parts to this 1.) How do I cascade menus? 2.) And, how do I cascade menus with a multi-select CheckBoxList?
by: deepakthegeek | last post by:
I dont know if this kind of issue has been addressed earlier. I have a gridview control on a form, in the EditItem Template when a textbox is clicked, I have a popupcontrolextender displaying an...
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
by: lllomh | last post by:
How does React native implement an English player?
by: Mushico | last post by:
How to calculate date of retirement from date of birth
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.