473,782 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

template column checkbox problem in grid view

I have the following on my page... a link button that will send the command
name "use" to the command handler and a grid view with the following columns

0 - Template column - just a checkbox (asp.net control)
1 - Bound column - DisplayName from data table

the checkbox is just a template i made by placeing an asp.net control into
the item template

when I check items on the grid then click the link and execute the following
code in it

Protected Sub ToolbarCommand( ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Comm andEventArgs) Handles
lnkUseRecipient s.Command, lnkCancel.Comma nd

Select Case e.CommandName.T rim.ToCharArray

Case "USE"

For Each _gvRow As GridViewRow In Me.GridView1.Ro ws

' perform the selected command on all checked messages

If DirectCast(_gvR ow.Cells(0).Con trols(1), CheckBox).Check ed Then

'do something here

End If

Next

end sub

when I run through it, all the items come back as unchecked... but the
strange thing... similar method on another page doing it the same way and it
comes back with items checked! why would one post back the checked items and
the other not? what should I look for? any suggestions on how to help?
thanks!
Jun 27 '06 #1
2 2804
I should probably add the grid is databound to a typed collection that
inherited from the collectionbase on the page that doesnt work, and the page
that does work is tied to a datatable
"Smokey Grindle" <no********@don tspam.net> wrote in message
news:eM******** ******@TK2MSFTN GP02.phx.gbl...
I have the following on my page... a link button that will send the command
name "use" to the command handler and a grid view with the following
columns

0 - Template column - just a checkbox (asp.net control)
1 - Bound column - DisplayName from data table

the checkbox is just a template i made by placeing an asp.net control into
the item template

when I check items on the grid then click the link and execute the
following code in it

Protected Sub ToolbarCommand( ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Comm andEventArgs) Handles
lnkUseRecipient s.Command, lnkCancel.Comma nd

Select Case e.CommandName.T rim.ToCharArray

Case "USE"

For Each _gvRow As GridViewRow In Me.GridView1.Ro ws

' perform the selected command on all checked messages

If DirectCast(_gvR ow.Cells(0).Con trols(1), CheckBox).Check ed Then

'do something here

End If

Next

end sub

when I run through it, all the items come back as unchecked... but the
strange thing... similar method on another page doing it the same way and
it comes back with items checked! why would one post back the checked
items and the other not? what should I look for? any suggestions on how to
help? thanks!

Jun 27 '06 #2
nevermind im stupid today.. i was rebinding on postback in page load.. which
was clearing the data..
"Smokey Grindle" <no********@don tspam.net> wrote in message
news:uT******** *****@TK2MSFTNG P05.phx.gbl...
I should probably add the grid is databound to a typed collection that
inherited from the collectionbase on the page that doesnt work, and the
page that does work is tied to a datatable
"Smokey Grindle" <no********@don tspam.net> wrote in message
news:eM******** ******@TK2MSFTN GP02.phx.gbl...
I have the following on my page... a link button that will send the
command name "use" to the command handler and a grid view with the
following columns

0 - Template column - just a checkbox (asp.net control)
1 - Bound column - DisplayName from data table

the checkbox is just a template i made by placeing an asp.net control
into the item template

when I check items on the grid then click the link and execute the
following code in it

Protected Sub ToolbarCommand( ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Comm andEventArgs) Handles
lnkUseRecipient s.Command, lnkCancel.Comma nd

Select Case e.CommandName.T rim.ToCharArray

Case "USE"

For Each _gvRow As GridViewRow In Me.GridView1.Ro ws

' perform the selected command on all checked messages

If DirectCast(_gvR ow.Cells(0).Con trols(1), CheckBox).Check ed Then

'do something here

End If

Next

end sub

when I run through it, all the items come back as unchecked... but the
strange thing... similar method on another page doing it the same way and
it comes back with items checked! why would one post back the checked
items and the other not? what should I look for? any suggestions on how
to help? thanks!


Jun 28 '06 #3

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

Similar topics

1
1307
by: William Gower | last post by:
I need to develop a datagrid that uses columns from a table. In addition I need two columns (checkboxes) that the user will use to indicate that this record can be closed later. The checkboxed column is not a field in the table. It is just for the purposes of the Datagrid and I do not need to store whether it was checked or not. Do I use a Template Column for this?
4
2179
by: Chris | last post by:
I've searched, reviewed, and attempted dozens of code ideas on the subject. I can't seem to get something that seems so simple to work. To highlight a row in a datagrid based on another value in that row. I have a datagrid using Template and Item Columns, i.e.: <asp:TemplateColumn HeaderText="CA Date Req" HeaderStyle-CssClass="gridqtext" ItemStyle-CssClass="gridtext"> <ItemTemplate> <asp:Label ID="lblcadatereq" CssClass="gridtext"...
1
2892
by: Shahid Saleem | last post by:
Dear Members I am using a data list , in the item template i have used a data grid with template column (CheckBox) and a button named sumbit. I want to get the data grid selected rows(Makred checked) upon click of sumbit button. I am looking where to write code for sumbission button when it is being used in item template??
1
2756
by: Abhishek | last post by:
I am creating a Datagrid at runtime and I have to create all the columns of grid at runtime... I am facing problem in the item template column. Here I want to place more than one control... For example Suppose there is a template column tc and i want to place two drop downlist in this tc say DrpList1 and DrpList2... Can anyone provide me any idea how to do this... I am getting many examples of adding items to the item template column by...
2
10406
by: Charleees | last post by:
Hi all, I have a DataGrid with Template Columns..... There are LAbels,Linkbuttons in the Single Row.. I have to set the Constant Column width for those Template Columns in Grid... Wat actually happens is... when the Text size is too big... the column
1
1296
by: Gunawan | last post by:
Hi, I could add a boundcolumn to gridview using this BoundColumn bc = new BoundColumn(); bc.DataField = "ProductsName"; bc.HeaderText = "Product"; gridview1.columns.add(bc); What I would like to ask, how can I perform this with TemplateColumn? I have a problem to bound template column to any object such as dropdownlist
3
2713
by: Shaileshsharma | last post by:
Hi, I am using Grid View Template field(Check Box) for delete a row, but i need a message box(OK/Cancle) should display before deleting the row.My C# Code like this for deleting the row when we click on check box of grid view. protected void CheckBox2_CheckedChanged(object sender, EventArgs e) { CheckBox chk = (CheckBox)sender; GridViewRow row = (GridViewRow)chk.NamingContainer; if (chk.Checked ==...
3
1719
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have a generic list of data list <typelistcategory; listcategory = new list <type>; I also have a dropdown box that I have put into a template column of a gridview. I was able to populate the dropdown box ok when it was outside of the gridview for (int i = 0; i <= listcategory.Count - 1; i++) { ddl.Items.Add(listcategory.Description);
1
6751
by: rogerford | last post by:
I have a grid which i bind with values from Database. I have events to edit and update the grid. I am not using SqlDatasource to connect to DB. Rather i am doing the updating of the grid Programmatically. I have 3 columns, LID(item template column) ,LVal (Edit Item template column) and Edit link My Question: 1) My EditITemTemplate column has a textbox txt_Lval which does not show up on the page load. But if click on edit link that...
0
10313
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10146
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10080
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9944
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5378
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
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

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.