Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

Access Control In DataGrid Header

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RN1 - 08 Mar 2008 02:01 GMT
Consider the following DataGrid:

--------------------------------------------------------------------------------
<asp:DataGrid ID="dgMarks" AutoGenerateColumns="false" runat="server">
<Columns>
<asp:TemplateColumn>
<HeaderTemplate>
<asp:CheckBox ID="chkHeader" OnCheckedChanged="CheckUncheckAllRows"
AutoPostBack="true" runat="server"/>
</HeaderTemplate>

<ItemTemplate>
<asp:CheckBox ID="chkItem" OnCheckedChanged="CheckChanged"
AutoPostBack="true" runat="server"/>
</ItemTemplate>
</asp:TemplateColumn>
</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 OnCheckedChanged event
handler of the CheckBox with the ID chkItem with the following code:

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

   chkSelHeader =
dgMarks.Controls(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
RN1 - 09 Mar 2008 19:30 GMT
> Consider the following DataGrid:
>
[quoted text clipped - 40 lines]
>
> 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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.