Edit DataGrid Header

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

  1. #1

    Default Edit DataGrid Header


    Hey ppl...

    I got my datagrid column edited by coding the ItemDataBound event with the
    following code:

    If e.Item.ItemType=ListItemType.Header Then
    e.Item.Cells(6).Text="Rental (USD)"
    End if

    I find that when i display the grid now, the column headers doesn't have the
    hyperlink behavior and therefore i cant sort it. How do i go about adding
    the hyperlink behavior ? Why does it go off when you change the header ?

    regards,
    Mike


    Mike Smith Guest

  2. Similar Questions and Discussions

    1. Would like to load a datagrid already in edit mode instead of having the user click the edit button
      Now my asp.net datagrid shows an edit button and clicking it puts the datagrid in edit mode. I would like to: 1) possilby load the page already...
    2. Set the width of the edit textbox after clicking on Edit link in datagrid...
      Hi There, I have a data grid where I have a couple of columns as follows: ----------------------------------------- |id | textual...
    3. DataGrid easy Edit-Update using ADO.NET/DataGrid functionality C#?
      Hi, so I am using built in Edit, Delete, Update i.e. OnEditCommand="DataGrid1_Edit" OnUpdateCommand="DataGrid1_Update" with handler question below...
    4. datagrid header
      Is it possible to have an overall header that spans across all columns? An example would be a class schedule for student Ben. |Ben |English ...
    5. To all Gurus: How can I edit/update a DataGrid in a DataGrid (nested DataGrid)? Possible?
      Hello, I am searching the whole Internet for a good example how to edit/update a DataGrid in a DataGrid (nested DataGrid). I know how to...
  3. #2

    Default Re: Edit DataGrid Header

    Mike Smith wrote:
    > Hey ppl...
    >
    > I got my datagrid column edited by coding the ItemDataBound event
    > with the following code:
    >
    > If e.Item.ItemType=ListItemType.Header Then
    > e.Item.Cells(6).Text="Rental (USD)"
    > End if
    >
    > I find that when i display the grid now, the column headers doesn't
    > have the hyperlink behavior and therefore i cant sort it. How do i go
    > about adding the hyperlink behavior ? Why does it go off when you
    > change the header ?
    >
    > regards,
    > Mike
    What about:
    (CType(e.Item.Cells(6).Controls(0),HyperLink)).Tex t="Rental (USD)"

    --

    Jos


    Jos Guest

  4. #3

    Default Re: Edit DataGrid Header

    hey jos...
    i tried that code out.. didnt seem to work ... the column retained its
    original name itself as RENTAL
    it wasnt assigned the new RENTAL (USD) .
    Any other suggestions ?
    is there a recommended best practice in dealin with datagrids and data ?
    Boundcolumns ? guess i have to sit my butt down and do the templates and all
    that ?

    "Jos" <josnospambranders@fastmail.fm> wrote in message
    news:uvjhUcCgDHA.3228@tk2msftngp13.phx.gbl...
    > Mike Smith wrote:
    > > Hey ppl...
    > >
    > > I got my datagrid column edited by coding the ItemDataBound event
    > > with the following code:
    > >
    > > If e.Item.ItemType=ListItemType.Header Then
    > > e.Item.Cells(6).Text="Rental (USD)"
    > > End if
    > >
    > > I find that when i display the grid now, the column headers doesn't
    > > have the hyperlink behavior and therefore i cant sort it. How do i go
    > > about adding the hyperlink behavior ? Why does it go off when you
    > > change the header ?
    > >
    > > regards,
    > > Mike
    >
    > What about:
    > (CType(e.Item.Cells(6).Controls(0),HyperLink)).Tex t="Rental (USD)"
    >
    > --
    >
    > Jos
    >
    >

    Mike Smith Guest

  5. #4

    Default Re: Edit DataGrid Header

    Do wot jos sed - but in ItemCreated event instead!

    "Mike Smith" <manilamike2000@yahoo.com> wrote in message news:OcqHjGFgDHA.3616@TK2MSFTNGP11.phx.gbl...
    > hey jos...
    > i tried that code out.. didnt seem to work ... the column retained its
    > original name itself as RENTAL
    > it wasnt assigned the new RENTAL (USD) .
    > Any other suggestions ?
    > is there a recommended best practice in dealin with datagrids and data ?
    > Boundcolumns ? guess i have to sit my butt down and do the templates and all
    > that ?
    >
    > "Jos" <josnospambranders@fastmail.fm> wrote in message
    > news:uvjhUcCgDHA.3228@tk2msftngp13.phx.gbl...
    > > Mike Smith wrote:
    > > > Hey ppl...
    > > >
    > > > I got my datagrid column edited by coding the ItemDataBound event
    > > > with the following code:
    > > >
    > > > If e.Item.ItemType=ListItemType.Header Then
    > > > e.Item.Cells(6).Text="Rental (USD)"
    > > > End if
    > > >
    > > > I find that when i display the grid now, the column headers doesn't
    > > > have the hyperlink behavior and therefore i cant sort it. How do i go
    > > > about adding the hyperlink behavior ? Why does it go off when you
    > > > change the header ?
    > > >
    > > > regards,
    > > > Mike
    > >
    > > What about:
    > > (CType(e.Item.Cells(6).Controls(0),HyperLink)).Tex t="Rental (USD)"
    > >
    > > --
    > >
    > > Jos
    > >
    > >
    >
    >

    Stevie_mac Guest

  6. #5

    Default Re: Edit DataGrid Header

    i got it done in ItemDataBound....
    it was LinkButton instead
    CType(e.Item.Cells(6).Controls(0), LinkButton).Text = "Rental (USD)"

    Thank JOS !



    "Stevie_mac" <no.email@please.com> wrote in message
    news:bkks8f$8uc$1@newsg4.svr.pol.co.uk...
    > Do wot jos sed - but in ItemCreated event instead!
    >
    > "Mike Smith" <manilamike2000@yahoo.com> wrote in message
    news:OcqHjGFgDHA.3616@TK2MSFTNGP11.phx.gbl...
    > > hey jos...
    > > i tried that code out.. didnt seem to work ... the column retained its
    > > original name itself as RENTAL
    > > it wasnt assigned the new RENTAL (USD) .
    > > Any other suggestions ?
    > > is there a recommended best practice in dealin with datagrids and data ?
    > > Boundcolumns ? guess i have to sit my butt down and do the templates and
    all
    > > that ?
    > >
    > > "Jos" <josnospambranders@fastmail.fm> wrote in message
    > > news:uvjhUcCgDHA.3228@tk2msftngp13.phx.gbl...
    > > > Mike Smith wrote:
    > > > > Hey ppl...
    > > > >
    > > > > I got my datagrid column edited by coding the ItemDataBound event
    > > > > with the following code:
    > > > >
    > > > > If e.Item.ItemType=ListItemType.Header Then
    > > > > e.Item.Cells(6).Text="Rental (USD)"
    > > > > End if
    > > > >
    > > > > I find that when i display the grid now, the column headers doesn't
    > > > > have the hyperlink behavior and therefore i cant sort it. How do i
    go
    > > > > about adding the hyperlink behavior ? Why does it go off when you
    > > > > change the header ?
    > > > >
    > > > > regards,
    > > > > Mike
    > > >
    > > > What about:
    > > > (CType(e.Item.Cells(6).Controls(0),HyperLink)).Tex t="Rental (USD)"
    > > >
    > > > --
    > > >
    > > > Jos
    > > >
    > > >
    > >
    > >
    >
    >

    Mike Smith 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