Hi folks,
I have a datagrid which contains a template item checkbox column. I've
included a checkbox as a HeaderTemplate item which fires a server-side
function to check or uncheck all the values in the underlying datatable
column, and resets the binding to the datagrid.
The only problem is that, when the user pages back and forth in the
datagrid, their selection is overwritten with the default selection in page
load. So, if the user unchecks the Select All box and then pages forward in
the datagrid, the Select All box now shows the default value (checked).
Does anybody have any ideas on how to programmaticall y set the
headertemplate checkbox when the page posts back?
Thanks in advance,
Andre Ranieri
<HeaderTemplate >
<asp:CheckBox id="chkAll" Checked="True" OnCheckedChange d="CheckAll"
runat="server" AutoPostBack="t rue"
ToolTip="Select/Deselect All"></asp:CheckBox><f ont face="Webdings"
color="white" size="4">a</font><!-- <INPUT
onclick="javasc ript:SelectAllC heckboxes(this) ;" type="checkbox" > -->
</HeaderTemplate> 2 5441
On Tue, 15 Mar 2005 14:03:06 -0600, Andre Ranieri""
<An**********@d iscussions.micr osoft.com> wrote: Hi folks,
I have a datagrid which contains a template item checkbox column. I've included a checkbox as a HeaderTemplate item which fires a server-side function to check or uncheck all the values in the underlying datatable column, and resets the binding to the datagrid.
The only problem is that, when the user pages back and forth in the datagrid, their selection is overwritten with the default selection in page load. So, if the user unchecks the Select All box and then pages forward in the datagrid, the Select All box now shows the default value (checked).
Does anybody have any ideas on how to programmaticall y set the headertemplate checkbox when the page posts back?
Thanks in advance,
Andre Ranieri
<HeaderTemplate >
<asp:CheckBox id="chkAll" Checked="True" OnCheckedChange d="CheckAll" runat="server" AutoPostBack="t rue"
ToolTip="Select/Deselect All"></asp:CheckBox><f ont face="Webdings" color="white" size="4">a</font><!-- <INPUT onclick="javasc ript:SelectAllC heckboxes(this) ;" type="checkbox" > -->
</HeaderTemplate>
I believe the following has what you're looking for: http://www.codeproject.com/aspnet/ChkBoxInGrid.asp
--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Craig,
I've been taking a look at the codeproject.com source samples, they're
pretty similar to the web app I'm building.
I might be misreading the article, but I'm not sure it addresses my core
question, which is how to change the value on the header checkbox itself.
I've already managed to manipulate the value on the item checkboxes when the
header checkbox is clicked, but I can't seem to affect the value of that
header checkbox itself, on postback when the datagrid page index changes.
Thanks in advance for any assistance,
Andre Ranieri This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Sebi |
last post by:
Hello all
is it possible to add a checkbox in a DataGrid for
Boolean Data?
Thanks in advance
|
by: MS Newsgroups |
last post by:
Hi,
I have managed to create a Datagrid with a template column with checkboxes
following Q306227. The dataset i have bound to the datagrid contains 1
column that allows NULL value and I would like to bind the checkbox to be
checked if this value is anything else than DBNULL. I have used to designer
to create the grid and dataset etc, and from what I understand I need to
edit the databinding property of the checkbox in the template to...
|
by: Marty |
last post by:
I have a numeric Oracle field which stores -1 for true and 0 for
false. I am trying to populate a checkbox in a datagrid. In my SQL
statement, I used the Decode function so that when it populates the
dataset that I would store the string 'true' and 'false' rather than a
numeric value. I did this because I thought it would make it easier
to actually set the value in the checkbox. Anyway, I bind the dataset
to the datagrid. In my HTML...
|
by: Niclas Lindblom |
last post by:
Hi,
I have a datagrid that contains a checkbox template column. I have followed
the sample in Q306227, but I have a problem evaluating the content of the
datagrid columns to decide a value for the checkboxes check property.
According to the sample I should use this statement in the BindCheckbox
event to evaluate a column:
Public Sub BindCheckBox(ByVal sender As Object, ByVal e As EventArgs)
|
by: Lars Netzel |
last post by:
If I put a checkbox in a datagrid (ASP.NET) and set the Autopostback to true
I can catch OnChange event on checkbox but how do I then catch what
DataGridItemIndex is?
Can I use some Event in the Datagrid that will fire off when the Checkbox is
changed?
regards
/Lars
| |
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
|
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 control in a datagrid? Now I
have a Select column but the problem is that the user needs to select more
than one record and send them all to print, instead of being one by one like
is now with the Select column.
Another question, is it possible to...
|
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.
I know there is a lot of article on datagrid with checkbox but nothing
helped me .
Can anyone help me how to proceed ?
Thanks
|
by: =?Utf-8?B?UGFycm90?= |
last post by:
I cannot programmatically select a row in datagridview control. I use the
following instruction to change the selection of a row
dataGridView2.ClearSelection();
dataGridView2.Rows.Selected = true;
When I add another entry to the datagrid, I return to this routine and check
for the current row as follows:
DataGridViewRow row = dataGridView2.CurrentRow;
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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,...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |