How to retrieve controls in column header of a DataGrid?

I have controls in column header of a my DataGrid control grdDocumentDate. I use grdDocumentDate.FindControl() to look for the controls in column header but could not get them. Is there any way to solve the problem?

ImageButton ib = (ImageButton)grdDocumentDate.FindControl("ibDocDate");

ib always returns null.

<asp:datagrid id="grdDocumentDate" style="Z-INDEX: 118; LEFT: 24px; POSITION: absolute; TOP: 176px" runat="server" BorderWidth="0px" AllowSorting="True" AutoGenerateColumns="False" OnItemCommand="ShowMoreDetailsCommand" BackColor="Silver"
    Width="704px">
    <HeaderStyle BackColor="Lime"></HeaderStyle>
    <Columns>
     <asp:TemplateColumn>
      <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
      <ItemStyle HorizontalAlign="Center"></ItemStyle>
      <HeaderTemplate>
       <asp:CheckBox id="CheckBoxAll" runat="server" OnCheckedChanged="CheckBox_CheckedChanged" AutoPostBack="True"></asp:CheckBox>
      </HeaderTemplate>
      <ItemTemplate>
       <asp:CheckBox id="CheckBoxDate" runat="server"></asp:CheckBox>
      </ItemTemplate>
     </asp:TemplateColumn>
     <asp:TemplateColumn>
      <HeaderStyle HorizontalAlign="Center" Width="160px" VerticalAlign="Middle"></HeaderStyle>
      <ItemStyle HorizontalAlign="Center"></ItemStyle>
      <HeaderTemplate>
       <asp:Button id="DocDate" onclick="MyDataGrid_Sort" runat="server" BorderWidth="0px" BackColor="Lime"
        Text="Document Date"></asp:Button>&nbsp;
       <asp:ImageButton id="ibDocDate" runat="server" ImageUrl="pictures\movenext2.gif"></asp:ImageButton>
      </HeaderTemplate>
      <ItemTemplate>
       <asp:TextBox id=TextBoxDD runat="server" BorderWidth="0px" width="90px" Text='<%# GetDateString((DateTime)DataBinder.Eval(Container, "DataItem.DocDate")) %>'>
       </asp:TextBox>
      </ItemTemplate>
     </asp:TemplateColumn>
     <asp:BoundColumn DataField="Status" HeaderText="Status">
      <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
      <ItemStyle HorizontalAlign="Center"></ItemStyle>
     </asp:BoundColumn>
     <asp:TemplateColumn>
      <HeaderStyle HorizontalAlign="Center" Width="160px" VerticalAlign="Middle"></HeaderStyle>
      <ItemStyle HorizontalAlign="Center"></ItemStyle>
      <HeaderTemplate>
       &nbsp;
       <asp:Button id="DueDate" runat="server" onclick="MyDataGrid_Sort" BorderWidth="0px" BackColor="Lime"
        Text="Next Tickler Date"></asp:Button>
       <asp:ImageButton id="ibDueDate" runat="server" ImageUrl="pictures\movenext2.gif" Visible="False"></asp:ImageButton>
      </HeaderTemplate>
      <ItemTemplate>
       <asp:TextBox id=TextBoxNTD runat="server" BorderWidth="0px" Width="90px" Text='<%# GetDateString((DateTime)DataBinder.Eval(Container, "DataItem.DueDate")) %>'>
       </asp:TextBox>
      </ItemTemplate>
     </asp:TemplateColumn>
     <asp:TemplateColumn HeaderText="Date Received">
      <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
      <ItemStyle HorizontalAlign="Center"></ItemStyle>
      <ItemTemplate>
       <asp:TextBox id=TextBoxDR runat="server" Width="90px" Text='<%# GetDateString((DateTime)DataBinder.Eval(Container, "DataItem.DateReceived")) %>' BorderWidth="0px" />
      </ItemTemplate>
     </asp:TemplateColumn>
     <asp:BoundColumn DataField="TotalLettersSent" HeaderText="Total Letters Sent">
      <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
      <ItemStyle HorizontalAlign="Center"></ItemStyle>
     </asp:BoundColumn>
     <asp:ButtonColumn Text="More" CommandName="MoreDetails"></asp:ButtonColumn>
    </Columns>
   </asp:datagrid>

0
gardener01
9/10/2005 10:26:34 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

2 Replies
662 Views

Similar Articles

[PageSpeed] 3

Hi, try this

ImageButton ib = (ImageButton)grdDocumentDate.Controls[0].Controls[0].FindControl("ibDocDate");



Hope this helps...
Alvin Chooi
Microsoft ASP.NET™ Enthusiast v1.1 / v2.0, Malaysia
Blog : http://alvinzc.blogspot.com
0
alvinz_c
9/11/2005 5:46:35 AM
It works! Thank you!
0
gardener01
9/13/2005 10:51:48 PM
Reply:

Similar Artilces:

How to place a DataGrid Control with in a DataGrid Control
Hi, I want to place a DataGrid control in a DataGrid control can any one plz tell me the procedure to place the control Thanks in Advance Krisamigo <!---<asp:DataGrid ID=dg_List runat=server><Columns><asp:TemplateColumn><ItemTemplate><asp:DataGrid ID=dg_List2 Runat=server></asp:DataGrid> </ItemTemplate> </asp:TemplateColumn> </Columns> </asp:DataGrid> ---> Hardik Joshi...

Can you control selectability of DataGrid column headers?
We have a DataTable with sorting enabled.  The person that I am working for has a complaint:  he wants the user to be able to select a column for sorting whenever the mouse is over the text in the header text of the column;  as things stand now, the cursor must be positioned  just below the text before the browser will allow selection.  Is there a way to control this, or  is this functionality that is internal to the browser? This behavior appears to only be an issue in Internet Explorer, not Firefox. the sort headers are simply an anchor...

Data presentation control in another Data presentation control
 Hello,I want to make a menu with datalist or gridview control.Basically,the menu will be like this,Categories     Sub Categories.For example, for COMPUTING category there will be NOTEBOOKS DESKTOPS etc.There will be a image for CATEGORIES and linkbuttons with Subcategories.If I put a datalist inside a datalist and a link button inside the second datalist visually it satisfies my need.However,CommandArguments come from database to linkbutton.Andwhen one of these command buttons is cliked it must go to proper page.I dont know how to wrie an event_handler ,specifically, for...

Control No of records in DataGrid control
Hi I am having more than 5000 records in the table. I had set page size:50, its loading 5000 records and showing 50 records... working fine. But my requirement is when page is loading i need to get only 50 letest records from the database. If user clicks on next it need to be connected to database and get next 50 records. How i can put pointer at 50 th record? Is there any way to do this???... plz help Top function wont work for me. Hope the problem is clear regards cnu The SQLDataAdapter can limit the rowsets in one of the Fill() method overloads. Check it out in the ...

datagrid control in to Tabstrip control .
i need to insert a datagrid in a tabstrip seperator. is this possible? and in what way . Do you really mean Tabstrip "Seperator"? Or are you just trying to insert a DataGrid into a TabStrip control? ...

How do I control one control from another control?
I have a page page1.aspx which is within a master page. On page I have a table with two cells. Within each cell I have placed two controls (ascx) that I have developed. Now I'd like to be able to get these two controls to interact. One needs to update the other. One has some search criteria that the other one needs to update its gridview. One needs to make the other visible/not visible at certain times. Out of the box neither control can see each other at all. Is there a good article or someplace I can find some information on how to do this?  AllAboutFocus.com. Information Technolo...

Custom Control within a Control Control
I am developing a custom controls that will render headers for different web sites. Within these controls, I want to place another custom control that will change the language. I created the language control and had it implement IPostBackDataHandler. This control works fine if I drag it on a new web form, but if I tell a header custom control to render it problems occur. The Language Selector custom control does not have a Page member anymore and the event handlers do not work. Does anyone have any experience with doing something similiar? Anyone have any suggestions? Thanks, ...

EditItemTemplate control = ItemTemplate control
Hi Friends! I have a CheckBoxList inside a DataGrid template column (ItemTemplate). When ItemDataBound event is raised, this CheckBoxList is populated. As follow bellow: Private Sub grdUsuarios_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles grdUsuarios.ItemDataBound If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then Dim chlFilaisUsuariosDGRow As CheckBoxList = e.Item.FindControl("chlFiliaisUsuario_EditItem") chlFilaisUsuariosDGRow...

Can you have a datagrid control inside of a repeater control. If so, how do you reference the datagrid in code behind
Hello, If anyone can help, it would be greatly appreciated. I have a repeater control and I want to place a datagrid inside of the repeater control's item template. The problem is, I don't know how to reference the datagrid control in the code behind. Also, can I bind data into the headertemplate of the repeater control such as a name. Actually I would only need a name. Don't know about GridView inside the Repeater, but did you thought about Repeater inside the Repeater?(Example below)  1 Protected Sub rptMain_ItemDataBound(ByVal sender As Object, ByVal e As Syst...

ajax control in data presentation controls
can i add ajax controls (MaskedEdit) to presentation controls (dataGrid, dataForm)?? Hi,of course. But keep in mind that those controls are extenders, so you append them to an existing control. Just convert your GridView / DetailsView-fields into templated fields and add the extender you'd like to use to the controls.RegardsMarco Buerckel Don't forget to mark posts that were helpful as answers. Actually, if you looked at the source code for the Masked Edit Extender, you'd see  [TargetControlType(typeof(TextBox))]Meaning, targeting any control type other than textboxes...

Custom DataGrid control in user control
Hi there, I have created a custom datagrid control which i reference within a user control and it's corresponding code behind page. The problem I am encountering is that when I click on the paging buttons in the datagrid no event is fired, however if I reference the same control from a page everything works fine. I'm not sure where I am going wrong and would be greatful for any help that can be offered. I have not posted the code here as there is quite a lot although should anyone feel that it would be helpful in them coming to a solution I would be more than willing to do so. Cheer...

Trouble controlling .net controlls with CSS
 I am trying to control the :hover css property on <asp: Button> controls. Basically the css is working correctly to set the initial look of the button, but nothing is happening when I hover over the button. Here is my code:CSS:.sidebarButton{    width: 168px;     height: 45px;     background-color: #666666;     text-align: left;    font-weight: bold;    font-family: Century Gothic;    font-size: 13pt;    color: White;    border-style: none;  ...

Finding controls in datagrid in user control
Hi, here's the scenario. I had a datagrid in a page, worked fine. I've moved the datagrid to a user control, and the update code I had does not work anymore.   In the datagrid, I have: OnUpdateCommand="update_user"   In the class for the user control, I have:   Protected Sub update_user(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)   then later, as part of a loop that cycles through the field names - data_field(x):   Dim drop_down As DropDownList = CType(e.Item.FindControl(data_field(x)), DropDownList)sql_comm.parameters.add("@" & data_...

DataGrid column control
I have a datagrid, which users can scroll down instead of paging. (because i want user to able to use IE find function) However as I scroll down, I cannot see the datagrid column header text. What Can I do ? Box of chocolate for anyone who can solve ......... haha!!Share your knowledge, it's a way to achieve immortality Hi, Read : Creating a Scrollable DataGrid with a Fixed Header Have a look : MakeItScroll.com HTHK B ShajudeenAreYaar.comDubai, United Arab Emirates. Hello, you can find another example at the following link: Datagrid Examples. D...

Web resources about - How to retrieve controls in column header of a DataGrid? - asp.net.presentation-controls

Want to preview our new DataGrid for Xamarin.Forms?
tl;dr Zumero.DataGrid is a Xamarin.Forms control for displaying data in rows and columns. If you would be interested in testing and previewing ...

Mad King DataGrid
This post is about scrolling in WPF and the egocentric DataGrid control. I’ll give the project background but if all you’re interested in is ...

Stack Overflow
Stack Exchange log in - careers - chat - meta - about - faq Questions Tags Users Badges Unanswered Ask Question Top Questions interesting 295 ...

Microsoft Silverlight - Wikipedia, the free encyclopedia
Microsoft Silverlight is an application framework for writing and running rich Internet applications , with features and purposes similar to ...

Flash Builder Plug-in for SAP Netweaver Gateway - Adobe Labs
Search Navigation Labs Home Wiki Home Technologies Alchemy Blueprint Camera Profiles and DNG Profile Editor Cirrus ColdFusion 10 DNG Codec Fireworks ...

Casaba Security » Products » X5s Testing Tool For Finding XSS Vulnerabilities
Security analysis, consulting, development and testing partners who understand your business strategy.

CodeGuru - Microsoft developers related ideas, articles, tips, tricks, comments, downloads, and so much ...
CodeGuru is where developers can come to share ideas, articles, questions, answers, tips, tricks, comments, downloads, and so much more related ...

Caliburn Micro: WPF, Silverlight, WP7 and WinRT/Metro made easy.
A small, yet powerful framework designed for WPF, Silverlight and WP7. It implements a variety of UI patterns for solving real-world problems. ...

Quick Answers - CodeProject
Questions - Free source code and tutorials for Software developers and Architects.; Updated: 11 Jul 2012

license-discuss@opensource.org: 11636: first draft of license proliferation committee report
FYI,the first draft report of the OSI's License Proliferation Committee.To join the OSI's license proliferation discuss email list, send anemail ...

Resources last updated: 2/5/2016 4:04:13 PM