DataGrid formatting - only one column without borders

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

  1. #1

    Default Re: DataGrid formatting - only one column without borders

    Yes, it is possible

    do it on datagrid ItemCreate event:

    int i = getMyNonBorderColumnIndex();
    e.Item.Cells[i].Style.Add("BORDER-TOP-STYLE", "none");

    e.Item.Cells[i].Style.Add("BORDER-RIGHT-STYLE", "none");

    e.Item.Cells[i].Style.Add("BORDER-LEFT-STYLE", "none");

    e.Item.Cells[i].Style.Add("BORDER-BOTTOM-STYLE", "none");

    in this event you can also determine if item is Alternative or not:

    if(e.Item.ItemType == ListItemType.AlternatingItem){}

    HTH


    "Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
    news:OLysVNsSDHA.2252@TK2MSFTNGP12.phx.gbl...
    > Hello all!
    >
    > I have a question considering DataGrid control formatting: is it possible
    to
    > somehow set styles in such a way that rendered DataGrid displays borders
    in
    > certain columns and doesn't display borders in other columns (as is
    possible
    > e.g. with ordinary HTML table)? In fact, I would like to format
    differently
    > only one column that should have no borders and no AlternatingItem in
    > different colour while the rest of the single DataGrid should look
    > differently.
    > Is it possible?
    >
    > Thank you,
    > Hrvoje
    >
    >

    Anatoly Guest

  2. Similar Questions and Discussions

    1. Formatting Date in Column of DataGrid
      Hi guys, I have a WebServiceConnector component which is bound to a DataSet component, which is in turn bound to a DataGrid component. All is...
    2. Formatting the phone nos in the column in the datagrid
      I want to format the phone nos displayed in the column of the datagrid to ###-###-#### i tried the following in the ItemCreated event but is not...
    3. Datagrid column formatting
      Is it possible to set the column widths of a datagrid? This is driving me crazy, and I haven't found a solution yet. I'm pretty new to ASP.NET so...
    4. Formatting datagrid column to show boolean as Yes/no instead of truefalse
      Is there a way to change the formatting expression of a column in the property builder of the datagrid to make boolean values appear as yes/no...
    5. How to use formatting expression on DataGrid bound column.
      Refer http://www.c-sharpcorner.com/Code/2003/June/FormatDataGridData.asp http://www.c-sharpcorner.com/Code/2003/June/DataFormatString.asp HTH...
  3. #2

    Default Re: DataGrid formatting - only one column without borders

    It did help, thank you very much.

    Hrvoje


    "Anatoly" <anatolyr@gilat.com> wrote in message
    news:%23etXbTsSDHA.3188@tk2msftngp13.phx.gbl...
    > Yes, it is possible
    >
    > do it on datagrid ItemCreate event:
    >
    > int i = getMyNonBorderColumnIndex();
    > e.Item.Cells[i].Style.Add("BORDER-TOP-STYLE", "none");
    >
    > e.Item.Cells[i].Style.Add("BORDER-RIGHT-STYLE", "none");
    >
    > e.Item.Cells[i].Style.Add("BORDER-LEFT-STYLE", "none");
    >
    > e.Item.Cells[i].Style.Add("BORDER-BOTTOM-STYLE", "none");
    >
    > in this event you can also determine if item is Alternative or not:
    >
    > if(e.Item.ItemType == ListItemType.AlternatingItem){}
    >
    > HTH
    >
    >
    > "Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
    > news:OLysVNsSDHA.2252@TK2MSFTNGP12.phx.gbl...
    > > Hello all!
    > >
    > > I have a question considering DataGrid control formatting: is it
    possible
    > to
    > > somehow set styles in such a way that rendered DataGrid displays borders
    > in
    > > certain columns and doesn't display borders in other columns (as is
    > possible
    > > e.g. with ordinary HTML table)? In fact, I would like to format
    > differently
    > > only one column that should have no borders and no AlternatingItem in
    > > different colour while the rest of the single DataGrid should look
    > > differently.
    > > Is it possible?
    > >
    > > Thank you,
    > > Hrvoje
    > >
    > >
    >
    >

    Hrvoje Vrbanc 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