473,513 Members | 3,208 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Pass Checkbox to the datagrid data in C#.net

46 New Member
I am doing an application where i need to select some data from the grid,to select the data from the grid ,each and every row and column data should come with some selection control..m using checkbox here..so can ny body of u know how to pass checkboxes to the datagrid,so that we can select tha data from the grid....its urgent pls rp soon
Sep 10 '07 #1
5 2081
aliasruel
73 New Member
Hi neehakale,

To add a checkbox control in your datagrid.
1. Right click on your datagrid
2. Go to property builder
3. Select columns
4. In the Available columns box, select Template Column
5. After adding, click Ok Button.
6. Right click again on your datagrid but this time select Edit template
7. You will see that there is column(0).
8. In the item template, drag and drop a check box control.
9. after adding the check box control. right click again then select End Template Editing.
10. Your done adding a checkbox.
11. if you want to go back.. just follow the same procedure.


assuming the name of your checkbox control is CheckBox1
and your datagrid name is DataGrid1
please create a button named btnCheckedItems..
in the click event of this button.. you place the code below
this program will identify if there are checked items and perform any action.

private void btnCheckedItems_Click(object sender, System.EventArgs e)
{
//identify if there are checked items here
int NoOfCheckedItems=0;

foreach (DataGridItem i in DataGrid1.Items)
{
CheckBox ItemsChecked = (CheckBox) i.FindControl ("CheckBox1");
if (ItemsChecked.Checked)
{
NoOfCheckedItems +=1;
//retrieve/check the current value of the selected item
Response.Write(i.Cells[1].Text);
}
}
Response.Write(NoOfCheckedItems);
}

I hope this will help you.

Best Regards,
Ruel
YM ID:uelskies@yahoo.com




I am doing an application where i need to select some data from the grid,to select the data from the grid ,each and every row and column data should come with some selection control..m using checkbox here..so can ny body of u know how to pass checkboxes to the datagrid,so that we can select tha data from the grid....its urgent pls rp soon
Sep 10 '07 #2
neehakale
46 New Member
M not getting this column field in the property builder.....M usinf .net framework 1.1 visual studdio.net 2003....
Sep 10 '07 #3
santuvssantu
12 New Member
Hi,
You can create a template column for checkbox. Please go through below one.
Hope this helps.
http://www.xmlfox.com/CSsamples.htm
Sep 10 '07 #4
aliasruel
73 New Member
Hi neehakale]M,

Is it for Web or Windows Apps?
Because what I sent to you is for the web application (framework 1.1)
tnx.

Ruel



M not getting this column field in the property builder.....M usinf .net framework 1.1 visual studdio.net 2003....
Sep 10 '07 #5
neehakale
46 New Member
It is for Windows application.....pls help me
Sep 10 '07 #6

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

Similar topics

2
3109
by: Sebi | last post by:
Hello all is it possible to add a checkbox in a DataGrid for Boolean Data? Thanks in advance
0
2389
by: mike | last post by:
Hi there: I've read an excellent "how to"-article by Microsoft (no. 306227) - partly cited cited at the end of this email). I have implemented the code related to the part "How to Add a...
1
4141
by: iforsyth | last post by:
Have a paging datagrid with a checkbox control in column(0). ViewState is enabled. I check the checkbox in first row of the grid on a page and then the program hits this event: Private Sub...
1
1573
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...
10
2403
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...
2
3024
by: Adam Knight | last post by:
Hi all, I have a datagrid with a checkbox in one column. The checkbox is set to autopostback and calls a method named UpdateMailSubscribers. The first click on the checkbox cause the page to...
2
6404
by: Nu2ASP.NET | last post by:
What I am trying to do is essentially 'flip' the bits, when the user clicks in the checkbox. For example, if the CheckBox appears checked, and the user un-checks it, I want the underlying data...
9
1581
by: Rekha | last post by:
The data is filled in datagrid. I want to know how to add a checkbox column in datagrid? In the runtime, checkbox is checked then instead of checkbox value the (caseID )column value is retained....
3
3133
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...
0
7153
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
7432
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...
1
7094
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
5677
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
4743
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
3230
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...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1585
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 ...
0
452
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...

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.