473,405 Members | 2,415 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.

Retrieving the Value of a checkbox Webserver Control From a Datagrid

I am using a checkbox webserver controls in template column of a datagrid webserver Control

I am trying to iterate through the datagid and process rows based on the whether the checkbox for the row is checked or not. However when I attempt to retrieve the selection the checkbox.checked state is false for all rows regardless of whehter the checkbox was checked or not


Here is what I have any assistance appreciated


<Itemtemplate>
<asp:Checkbox id =”checkbox1” runat= “server” autopostback= “true”></asp:Checkbox>
</Item template>

Dim ChBox As CheckBox
intCount As integer



For intCount to Datagrid1.Items.count -1
ChBox = Datagrid1.Items(intCount).Cells(0).Controls(1)

If chBox.checked
‘Do some stuff

Else
‘Do something else

Next
Apr 9 '08 #1
1 967
dip_developer
648 Expert 512MB
I am using a checkbox webserver controls in template column of a datagrid webserver Control

I am trying to iterate through the datagid and process rows based on the whether the checkbox for the row is checked or not. However when I attempt to retrieve the selection the checkbox.checked state is false for all rows regardless of whehter the checkbox was checked or not


Here is what I have any assistance appreciated


<Itemtemplate>
<asp:Checkbox id =”checkbox1” runat= “server” autopostback= “true”></asp:Checkbox>
</Item template>

Dim ChBox As CheckBox
intCount As integer



For intCount to Datagrid1.Items.count -1
ChBox = Datagrid1.Items(intCount).Cells(0).Controls(1)

If chBox.checked
‘Do some stuff

Else
‘Do something else

Next

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim chkBox As CheckBox 
  3. ' Go through each row and find a check box 
  4. For Each i As DataGridItem In Datagrid1.Items 
  5. chkBox = CType(i.FindControl("checkbox1"), CheckBox) 
  6.  
  7. If chkBox .Checked Then 
  8. ''Do some stuff 
  9. Else
  10. ''Do something else 
  11. End If 
  12. Next
  13.  
Apr 10 '08 #2

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

Similar topics

3
by: Randy | last post by:
Hello, I'm creating a table on the fly that is used by a datagrid. I'm also creating a tableStyle that is used for the datagrid to make it look like I want. I'm using the DataGridBoolColumn to...
0
by: Just D | last post by:
Hi All, Does anybody know how to write the following code? I have a database table with a few columns including: ID , "Task" , ForceRun . I need to show the DataGrid on the ASPX page with...
1
by: Machi | last post by:
Let say i select rows of records with 4 columns from Database and want to display the data in DataGrid (ASP.NEt Server Control) with one column which must be displayed in CheckBox layout. For the...
1
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...
2
by: buran | last post by:
Dear ASP.NET Programmers, I have the following problem. I have a datagrid (ID: grdAllActions). This datagrid has two template columns: one column with the dropdownlist control (ID: ddlPS) and...
2
by: Asha | last post by:
greetings, i'm loading a datagrid and my gird has checkbox, i want these checkboxex to be check based on the value from the db? can someone please show me the code for it? thanks
10
by: Jennyfer J Barco | last post by:
Hello, I have a datagrid that brings some information from a query. I need to have a checkbox in each row so the user can select the rows he wants to reprint. Is it possible to have a checkbox...
3
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...
6
by: yasodhai | last post by:
Hi, I used a dropdown control which is binded to a datagrid control. I passed the values to the dropdownlist from the database using a function as follows in the aspx itself. <asp:DropDownList...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
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
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.