473,405 Members | 2,282 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,405 software developers and data experts.

Checkbox in datalist with ASP.net

i have checkbox in datalist and i need to find which checkbox is checked
name of checkbox = CheckBox1
and name of datalist is DataList1

i am writng this code to find the checked checkbox

foreach (DataListItem dli in DataList1.Items)
{

bool ok = ((CheckBox)dli.FindControl("CheckBox1")).Checked;
if (ok)
{
// ok
}
}


but the result is always false what i have to do


10x
Oct 16 '07 #1
5 5791
please reply urgent


10x
Oct 19 '07 #2
kenobewan
4,871 Expert 4TB
What event are you using? More info please.
Oct 19 '07 #3
What event are you using? More info please.

in my web page i have a button to check all checked checkbox
so i use Button_Click Event

i think the problem is how can i refresh my page

please reply

10x for helping me
Oct 19 '07 #4
kenobewan
4,871 Expert 4TB
Suggest you debug - is the event firing?
Oct 20 '07 #5
Solution To checkbox checked=false in datalist

Bind the data when page.ispostback is false

if( ! page.ispostback)
{
bindyourdata();
}


Comment:The problem why checkbox is showing checked status false is when u press the button, page post back occurs and datalist is populated again. So bind the data when page.ispostback is false
Feb 29 '08 #6

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

Similar topics

4
by: mahsa | last post by:
my problem dosent solve yet I want to have claa void in onclick of my check bov if I us function setProps ( ) msg.innerText = "llll"; in <datalist> <ItemTemplate><input type="checkbox"...
1
by: Glenn Owens | last post by:
Here's the scenario: I have a DataList populated from a datatable sitting inside a fieldset. Each element (row) in the Datalist has the following child controls: asp:checkbox, asp:image,...
0
by: yurps | last post by:
Hello I have a DataList like this <asp:DataList id="Questions" Runat="server"> <ItemTemplate> <table border="1"> <tr> <td> <asp:CheckBox ID="Yes" Runat="server"></asp:CheckBox> <input...
1
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...
2
by: Derek | last post by:
I have a datalist that contains one unbound column with a checkbox. When the user clicks a button, I need to count all the checked boxes in the datalist. Can anyone give me an idea as to the best...
0
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...
2
by: Paperback Writer | last post by:
I have a DataList with a lot of items where the user can select them trough the CheckBoxes but i don't have idea how to capture these values from the checkboxes to insert in my DataBase....How to...
1
by: rn5a | last post by:
A ASPX page has a DataList control with a few Labels. This page also has a CheckBox which resides OUTSIDE the DataList. By default, this CheckBox is checked. If the CheckBox is checked, then the...
0
by: simonakiki | last post by:
i have checkbox in datalist and i need to find which checkbox is checked name of checkbox = CheckBox1 and name of datalist is DataList1 i am writng this code to find the checked checkbox ...
1
by: rrayfield | last post by:
I create a datalist from a datatable that is created in code on the page. I have all of my values assigned to dropdowns and labels inside the DL and it runs through them. Everything works great ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
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,...

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.