473,434 Members | 1,854 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

selection via checkboxlist in gridview

35
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?

thanks
Sep 17 '07 #1
2 1979
mercea
35
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.     {
  3.  
  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.     }
  20.  
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
kenobewan
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

0
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....
2
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...
0
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...
0
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...
0
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...
0
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...
0
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...
6
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?
5
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.