473,569 Members | 2,768 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HOW: Finding checkbox control with a datalist control

JP
I have images within a datalist control. Below is a checkbox control that
contains the SQL ID of the image blob.

When the page is post back I want to iterate though checkbox collection to
get the IDs

Normally you can say Request["myCheckbox "] and get all the values for those
items that were checked. I want to access the "chkDelete" collection so I can
enumerate though the the collection. How do I access the check boxes within
the datalist??????? ?????

I tried (just to see if I get values) but Checkbox1 is always null:

System.Web.UI.H tmlControls.Htm lInputCheckBox Checkbox1 =
dataListControl .FindControl("c hkDelete") as HtmlInputCheckB ox;

Response.Write( Checkbox1.Value );
--
JP
..NET Software Develper
Jun 8 '06 #1
1 2226
Hello JP,

Use HttpRequest.For m (see msdn for samples) collection with the name of you
control.

J> I have images within a datalist control. Below is a checkbox control
J> that contains the SQL ID of the image blob.
J>
J> When the page is post back I want to iterate though checkbox
J> collection to get the IDs
J>
J> Normally you can say Request["myCheckbox "] and get all the values for
J> those items that were checked. I want to access the "chkDelete"
J> collection so I can enumerate though the the collection. How do I
J> access the check boxes within the datalist??????? ?????
J>
J> I tried (just to see if I get values) but Checkbox1 is always null:
J>
J> System.Web.UI.H tmlControls.Htm lInputCheckBox Checkbox1 =
J> dataListControl .FindControl("c hkDelete") as HtmlInputCheckB ox;
J>
J> Response.Write( Checkbox1.Value );
J>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Jun 8 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1581
by: Chip | last post by:
I'm using Andy Smith's RowSelectorColumn control (great control) and I'm not sure if this question is generic to all datagrid controls or this particular one. Is there a way to disable one of the checkboxes based on data in the grid? If so, can you provide the syntax? Thanks, Chip
1
3158
by: Doug | last post by:
The html below shows DataList "DiscountList" nested within DataList "EventItemList". DiscountList contains a Label control. I'm trying to find the label, using FindControl, during EventList_ItemCreated (below the html), but it's always <undefined value> (null). Everything else works fine. Eventually I need to set the value of the label...
4
6536
by: krzysiek | last post by:
hello, i have several radiolists and checkboxlist that are generated dinamicly based on datasource. So frankly speaking i don't know names and number of that web controls cose they are always different. How can i retreive selected values from those controls ?
1
3762
by: VB Programmer | last post by:
Simple: I have a datalist that is holding a bunch of job opportunities. Beside each opp (in the item template) there's a checkbox that says "apply". After the datalist there's a button that say's "process". I want to LOOP through each datalist entry and see if the user checked the check box. Simple. I wrote the code, but the checked...
0
961
by: UJ | last post by:
I'm trying to implement a checkbox in a datalist and am having real problems. I can get the checkbox into the datalist fine. I can bind it to a database value fine. Problem is, when somebody clicks it, and I call my routine showing it's changed, I don't have enough information to be able to update the database with the new value (like I don't...
0
1495
by: Patrick Olurotimi Ige | last post by:
I want to insert checkbox Y/N or 1/0 into a SQL table. I know i can do that using a bit field or Char field. My Question is i have Datalist that lists products and i want to put this checkBoxes in the Datalist. But in the Datalist there is a Link that adds the Products to a SQL table My Datalist looks like this below:- <asp:datalist...
5
13376
by: Patrick.O.Ige | last post by:
I'm binding a CheckBoxlist below in the ItemDataBound(the CheckBoxList is in a Datalist) By doing "li.Selected = True" i can see all the checkBoxes are selected. But what i want is to be able to get a Boolean value TRUE or FALSE when a checkBox is selected. When the checkBoxList was out of the DataList i used "OnSelectedIndexChanged"...
1
1733
by: bdwgarth | last post by:
I am working with a DataList which consists of dynamically changing number of rows and static number of columns. There are twelve columns and each is a singe CheckBox representing a Yes or No value(checked or not checked). I have a 'Check All' button (using OnItemCommand) for each row that needs check all of the CheckBoxes in that row so the...
3
3138
by: Fao, Sean | last post by:
I have a DataGrid that I'm adding CheckBox controls to at runtime (in the code behind) and I'm not sure if I'm doing it correctly. First of all, I noticed that the MyDataGrid.Columns.Add() method expects a DataGridColumn so I instantiated an object of type TemplateColumn that I had hoped I could add a CheckBox to. I soon discovered that the...
0
7695
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7668
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6281
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5218
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1209
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.