Adding a second row to a datagriditem?

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default Adding a second row to a datagriditem?

    Hi everyone,

    I'm wondering if anyone has a suggestion on how to do this, or if it's even
    possible.

    In my datagrid's OnItemDataBound function I'd like to somehow "add" a child
    row beneath one of the datagriditems (chosen via a QueryString variable) and
    use it to hold a secondary datagrid. It would act as a drilldown of sorts,
    showing more information not displayed in the datagriditem itself.

    I know I can add this new datagrid to one of the datagriditem's existing
    cells, but I can't get it to span multiple columns without shoving aside the
    other columns in the datagriditem. That's where my idea of this second row
    has come from. So far I'm not having any luck however.

    If you know of some way I can pull this off (or a reasonable facsimile
    thereof) I'd be grateful. Thanks very much!

    -Steve


    Steve Hershoff Guest

  2. Similar Questions and Discussions

    1. Casting DataGridItem
      agrids on six different pages which are editable. They each draw from a different SQLServer table. 2. When data is changed in any rows, the Row...
    2. DataGridItem.DataItem property?
      The help pages make it look like the DataGridItem.DataItem property would return a row from the bound table. Like so: //(during setup)...
    3. DataGrid Built In Paging and DataGridItem Problem
      Hi All: I am populating a Data Table with File/Folder information from my drive... I am then binding this data table to a DataGrid. Due to the...
    4. ItemCreate event handler changes wrong DataGridItem
      I am changing the EditText in a EditCommandColumn in a DataGrid in an ItemCreate event handler . The only problem I am having is that instead of...
    5. Problems with casting DataGridItem.findcontrol and DataGridItem.cells(0).control(1) to checkbox
      this peace of code is giving me trouble DIM i as DataGridItem for each i in myDataGrid checkbox chkbox =...
  3. #2

    Default Re: Adding a second row to a datagriditem?

    you should use datalist instead.. you will have more control on the HTML.

    I had the same issue in my recent project.. initially i tried with datagrids
    like you are doing.. but couldnt succeed.. so went with datalist's and it
    worked like a charm

    "Steve Hershoff" <babbaloo@nowhere.com> wrote in message
    news:%23Su6k4nuGHA.476@TK2MSFTNGP06.phx.gbl...
    > Hi everyone,
    >
    > I'm wondering if anyone has a suggestion on how to do this, or if it's
    > even possible.
    >
    > In my datagrid's OnItemDataBound function I'd like to somehow "add" a
    > child row beneath one of the datagriditems (chosen via a QueryString
    > variable) and use it to hold a secondary datagrid. It would act as a
    > drilldown of sorts, showing more information not displayed in the
    > datagriditem itself.
    >
    > I know I can add this new datagrid to one of the datagriditem's existing
    > cells, but I can't get it to span multiple columns without shoving aside
    > the other columns in the datagriditem. That's where my idea of this
    > second row has come from. So far I'm not having any luck however.
    >
    > If you know of some way I can pull this off (or a reasonable facsimile
    > thereof) I'd be grateful. Thanks very much!
    >
    > -Steve
    >

    Kumar Reddi Guest

  4. #3

    Default Re: Adding a second row to a datagriditem?

    As kumar explained use Datalist like so
    in ur ItemDataBund do
    Dim mychilddl As DataList =
    CType(e.Item.FindControl("idofdatalistinsidethepar entdatalist"), DataList)
    and then add control
    e.item.controls.Add(mychilddl)
    hope that helps
    Patrick


    "Kumar Reddi" <kumarreddi@gmail.com> wrote in message
    news:OvcRYBouGHA.4968@TK2MSFTNGP03.phx.gbl...
    > you should use datalist instead.. you will have more control on the HTML.
    >
    > I had the same issue in my recent project.. initially i tried with
    > datagrids like you are doing.. but couldnt succeed.. so went with
    > datalist's and it worked like a charm
    >
    > "Steve Hershoff" <babbaloo@nowhere.com> wrote in message
    > news:%23Su6k4nuGHA.476@TK2MSFTNGP06.phx.gbl...
    >> Hi everyone,
    >>
    >> I'm wondering if anyone has a suggestion on how to do this, or if it's
    >> even possible.
    >>
    >> In my datagrid's OnItemDataBound function I'd like to somehow "add" a
    >> child row beneath one of the datagriditems (chosen via a QueryString
    >> variable) and use it to hold a secondary datagrid. It would act as a
    >> drilldown of sorts, showing more information not displayed in the
    >> datagriditem itself.
    >>
    >> I know I can add this new datagrid to one of the datagriditem's existing
    >> cells, but I can't get it to span multiple columns without shoving aside
    >> the other columns in the datagriditem. That's where my idea of this
    >> second row has come from. So far I'm not having any luck however.
    >>
    >> If you know of some way I can pull this off (or a reasonable facsimile
    >> thereof) I'd be grateful. Thanks very much!
    >>
    >> -Steve
    >>
    >
    >

    Patrick.O.Ige Guest

  5. #4

    Default Re: Adding a second row to a datagriditem?

    > In my datagrid's OnItemDataBound function I'd like to somehow "add" a
    > child row beneath one of the datagriditems (chosen via a QueryString
    > variable) and use it to hold a secondary datagrid. It would act as a
    > drilldown of sorts, showing more information not displayed in the
    > datagriditem itself.
    Do not override OnItemDataBound but handle the event ItemCreated or
    ItemDataBound.
    ItemDataBound is raised after ItemCreated and only for non-pager items.

    Note that the DataGridItem itself is a sub-class of TableRow meaning
    that you are working with a Table Row indirectly.
    However, keep a caution that if you directly manipulate the TableRow or
    its container Table, you may lose out the functionality related to the
    DataGrid... like DataBinding etc. But as what I see, that seems (or should
    be) ok with you since you'd be handling it yourself.



    --
    Happy Hacking,
    Gaurav Vaish | [url]http://www.mastergaurav.org[/url]
    [url]http://www.edujini.in[/url] | [url]http://webservices.edujini.in[/url]
    -------------------




    Gaurav Vaish \(www.EduJini.IN\) 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