access control in header template

Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

    Default access control in header template

    I got a label control which is dynamically created inside the
    headerTemplate of template column.
    And it is part of the datagrid.


    Please teach me how to read the content of that label control?

    I cannot use FindControl() function because it is created in runtime
    based on variable.
    And everytime the number of columns is different.

    I can access a textbox control in itemTemplate with following code
    (dgassignment is the datagrid)

    dim i as integer
    dim j as integer
    dim textboxhour as textbox
    dim dgi as datagriditem

    for i = 0 to dgassignment.items.count -1
    dgi = dgassignment.items(i)
    for j = 0 to dgi.cells.count -1
    textboxhour = ctype(dgi.cells(j).controls(0), textbox)
    next j
    next i

    But I have no idea how to get the control in header, please help,
    thanks.
    mor Guest

  2. Similar Questions and Discussions

    1. Best way to integrate Flash header into PHP web-template...
      Hi all, thanks in advance for the read-through. I have created an animation (about 10 secs) that I hope to use as the header for my PHP web-site...
    2. Header in a template column
      Hi, I have a checkbox in the header of a template column in a datagrid. How can I check during runtime that whether checkbox is checked or not?I...
    3. New template in word does not show header/footer
      When opening a new template in word, the document does not automtaically show the header/footer. I have checked the page set-up and tried to alter...
    4. Problem to Access web control on the DataGrid Header
      Hi The Items Collection of DataGrid does not hold Header and Footer. So to access the Control you need to handle ItemCreated event. HTH...
    5. Template Column with button in header
      Hi, usually Button clicks inside DataGrid are managed by handling ItemCommand event of the grid. Button is given a CommandName that is checked in...
  3. #2

    Default Re: access control in header template

    Couldn't you just use the ItemDataBound event on the datagrid and test for
    the itemType = Header?

    sub DataGrid_ItemDataBound(sender as object, e as DataGridItemEventArgs)
    if e.Item.ItemType = ListItemType.Header Then
    do a findcontrol() here.
    end if
    end Sub

    HTH.
    Ben Miller
    --
    Get Secure! - [url]www.microsoft.com/security[/url]
    This posting is provided "as is" with no warranties and confers no rights.


    "mor" <royguard@hotmail.com> wrote in message
    news:177c14a0.0405271806.5eadc445@posting.google.c om...
    > I got a label control which is dynamically created inside the
    > headerTemplate of template column.
    > And it is part of the datagrid.
    >
    >
    > Please teach me how to read the content of that label control?
    >
    > I cannot use FindControl() function because it is created in runtime
    > based on variable.
    > And everytime the number of columns is different.
    >
    > I can access a textbox control in itemTemplate with following code
    > (dgassignment is the datagrid)
    >
    > dim i as integer
    > dim j as integer
    > dim textboxhour as textbox
    > dim dgi as datagriditem
    >
    > for i = 0 to dgassignment.items.count -1
    > dgi = dgassignment.items(i)
    > for j = 0 to dgi.cells.count -1
    > textboxhour = ctype(dgi.cells(j).controls(0), textbox)
    > next j
    > next i
    >
    > But I have no idea how to get the control in header, please help,
    > thanks.

    Ben Miller [MSFT] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139