473,795 Members | 2,410 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access Control In DataGrid Header

RN1
Consider the following DataGrid:

--------------------------------------------------------------------------------
<asp:DataGrid ID="dgMarks" AutoGenerateCol umns="false" runat="server">
<Columns>
<asp:TemplateCo lumn>
<HeaderTemplate >
<asp:CheckBox ID="chkHeader" OnCheckedChange d="CheckUncheck AllRows"
AutoPostBack="t rue" runat="server"/>
</HeaderTemplate>

<ItemTemplate >
<asp:CheckBox ID="chkItem" OnCheckedChange d="CheckChanged "
AutoPostBack="t rue" runat="server"/>
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>
</asp:DataGrid>
--------------------------------------------------------------------------------

Note that the CheckBox with the ID chkHeader is in the Header of the
DataGrid. This CheckBox can be accessed in the OnCheckedChange d event
handler of the CheckBox with the ID chkItem with the following code:

--------------------------------------------------------------------------------
Sub CheckChanged(ob j As Object, ea As EventArgs)
Dim chkSelHeader As CheckBox

chkSelHeader =
dgMarks.Control s(0).Controls(0 ).FindControl(" chkHeader")
End Sub
--------------------------------------------------------------------------------

If I am not mistaken, because the CheckBox with the ID chkHeader
resides in the Header of the DataGrid, Controls(0) has been used twice
to access this CheckBox.

Can someone please explain me why Controls(0) been used twice to
access the CheckBox that resides in the Header of the DataGrid (whose
ID is chkHeader)? Which controls do the two Controls(0) refer to?

Thanks,

Ron
Mar 8 '08 #1
1 2158
RN1
On Mar 8, 7:01*am, RN1 <r...@rediffmai l.comwrote:
Consider the following DataGrid:

---------------------------------------------------------------------------*-----
<asp:DataGrid ID="dgMarks" AutoGenerateCol umns="false" runat="server">
<Columns>
<asp:TemplateCo lumn>
<HeaderTemplate >
<asp:CheckBox ID="chkHeader" OnCheckedChange d="CheckUncheck AllRows"
AutoPostBack="t rue" runat="server"/>
</HeaderTemplate>

<ItemTemplate >
<asp:CheckBox ID="chkItem" OnCheckedChange d="CheckChanged "
AutoPostBack="t rue" runat="server"/>
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>
</asp:DataGrid>
---------------------------------------------------------------------------*-----

Note that the CheckBox with the ID chkHeader is in the Header of the
DataGrid. This CheckBox can be accessed in the OnCheckedChange d event
handler of the CheckBox with the ID chkItem with the following code:

---------------------------------------------------------------------------*-----
Sub CheckChanged(ob j As Object, ea As EventArgs)
* * Dim chkSelHeader As CheckBox

* * chkSelHeader =
dgMarks.Control s(0).Controls(0 ).FindControl(" chkHeader")
End Sub
---------------------------------------------------------------------------*-----

If I am not mistaken, because the CheckBox with the ID chkHeader
resides in the Header of the DataGrid, Controls(0) has been used twice
to access this CheckBox.

Can someone please explain me why Controls(0) been used twice to
access the CheckBox that resides in the Header of the DataGrid (whose
ID is chkHeader)? Which controls do the two Controls(0) refer to?

Thanks,

Ron
I don't know why but there are quite a few questions I have put
forward in this ASP.NET newsgroup but don't get any help for them. &
as far as my knowledge in ASP.NET (which is limited I must confess), I
guess the questions I have been asking are pretty basic but still I
don't get any responses for them.

I guess there must be a severe shortage of ASP.NET MVPs, experts &
gurus..... Since long I have been using the various Microsoft
newsgroups like ASP, SQL Server etc. & have always got help from
others but I don't know what's wrong with this newsgroup This
newsgroup has indeed left a bad taste in my mouth.

Ron
Mar 9 '08 #2

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

Similar topics

0
1001
by: Andy Eshtry | last post by:
Hello Dear Professionals: Based on this document: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskcreatingwebservercontroltemplatesdynamically.asp or this http://www.dnzone.com/ShowDetail.asp?NewsId=599 I want to create 3 template column in datagrid dynamically while the template columns contains image buttons for add, edit and delete. As you can see, I can figure out the commandname inside the...
4
5481
by: Kaung Htut O via DotNetMonster.com | last post by:
Hi to all Is there a way to access Datalist Footer's Control properties from outside of datalist event. Pls note that I mean not a datagrid, only for datalist. Thanks Kaung Htut Oo
2
368
by: ChrisM | last post by:
Can anyone please tell me what I'm doing wrong here. I have a Windows Form with a DataGrid on it, and I'm having real problems with the Sorting. It is easy to reproduce the problem I have. If you create a new Windows Application Put a DataGrid control on it. Put the following in the onload event of the form:
2
3959
by: Stan | last post by:
This is how I access Pieces field in my editable datargid during Update event: protected void grdMain_OnUpdate(Object sender, DataGridCommandEventArgs e) { string Pieces = ((TextBox) e.Item.FindControl ("txtPieces")).Text; .... }
2
2114
by: | last post by:
Hello All, I am having a lot of difficulty trying to bind a templated column, that is programmatically created for a datagrid, to a datasource column. I have a datasource containing 2 columns, ID and VALUE. I would like to create a templated column in the datagrid that is bound to the VALUE column of the datasource.
5
5133
by: Paul | last post by:
Hi I need to change the text value of a dropdown list box that is in a template column of a data grid but was not sure how to access it, probably something like datagrid1.control.dropdownlist.text = "" but not sure. -- Paul G Software engineer.
1
5847
by: Raed Sawalha | last post by:
i have aspx page with user control containing a datagrid , the datagrid has TempleteColumn with checkbox in header and item ( doing multiselect task) I wondering how Can get the checkboxes status from aspx page this is my datagrid in the user control <asp:datagrid id="dgFoldersInfo" runat="server" BorderColor="Black" BorderWidth="0px" HeaderStyle-CssClass="tableHeaderCell" ShowFooter="True" CellPadding="3" GridLines="Horizontal"...
0
1483
by: upendra | last post by:
Hi, I am B.V.Ramesh Babu.I am working as software programmer using .net.We are using asp.net1.1 with C#.net as coding.I hope that i will get the required support from you. Here is my requirement. I am using datagrid control.In that data grid I put checkboxes in both item templete and in Header templete.My requirement is is if i check any checkbox in itemtemplete and click delete button those records will be deleted.In another way I ...
0
1438
by: Reddy4All | last post by:
Hi- Is there any possiblity to make Datagrid control (Winforms) column header sort arrow more prominent in .net 2003. In Windows forms Datagrid control, when user click on the column header, default sort arrow will appear but i want to replace it by another image or bitmap file. Is there any possiblity or any methods to override, so that we can place different arrow or image on the datagrid contol column header sort arrow look more prominent? ...
0
10437
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
10214
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
10164
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,...
1
7538
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
6780
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5437
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
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3723
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
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 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...

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.