Hello Matthew,
You are welcome. If you have follow up questions, please feel free to post in the group and we are glad to be of assistance.
Thanks very much for participating the community.
Best regards,
Yanhong Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
!Date: Thu, 14 Aug 2003 08:56:44 -0400
!From: Matthew Wieder <
[email protected]>
!User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)
!X-Accept-Language: en-us, en, he
!MIME-Version: 1.0
!Subject: Re: Empty DataGrid Formatting
!References: <
[email protected]> <#
[email protected]>
<
[email protected]> <5n9#
[email protected]> <3F3A77A0.1000308
@SatoriGroupInc.com> <p#
[email protected]>
!In-Reply-To: <p#
[email protected]>
!Content-Type: text/plain; charset=ISO-8859-1; format=flowed
!Content-Transfer-Encoding: 8bit
!Message-ID: <#
[email protected]>
!Newsgroups: microsoft.public.dotnet.framework.aspnet
!NNTP-Posting-Host: 207.106.112.178
!Lines: 1
!Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:167845
!X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
!
!Thanks!
!
!Yan-Hong Huang[MSFT] wrote:
!> Hello Matthew,
!>
!> Now I understand what you need now.
Ram is right. If we don't set
!> DataGrid's Height property, the height of the header row will return to
!> normal. I have tested it on my side and it looks nice now.
!>
!> If you have follow up questions, please post here. Thanks very much.
!>
!> Best regards,
!> Yanhong Huang
!> Microsoft Online Partner Support
!>
!> Get Secure! ¨C
www.microsoft.com/security
!> This posting is provided "AS IS" with no warranties, and confers no rights.
!>
!> --------------------
!> !Message-ID: <
[email protected]>
!> !Date: Wed, 13 Aug 2003 13:38:40 -0400
!> !From: Matthew Wieder <
[email protected]>
!> !User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4)
!> Gecko/20030624 Netscape/7.1 (ax)
!> !X-Accept-Language: en-us, en, he
!> !MIME-Version: 1.0
!> !To: "Yan-Hong Huang[MSFT]" <
[email protected]>
!> !Subject: Re: Empty DataGrid Formatting
!> !References: <
[email protected]>
!> <#
[email protected]>
!> <
[email protected]>
!> <5n9#
[email protected]>
!> !In-Reply-To: <5n9#
[email protected]>
!> !Content-Type: text/plain; charset=us-ascii; format=flowed
!> !Content-Transfer-Encoding: 7bit
!> !Newsgroups: microsoft.public.dotnet.framework.aspnet
!> !NNTP-Posting-Host: 207.106.112.178
!> !Lines: 1
!> !Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
!> !Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:167586
!> !X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
!> !
!> !I'm not sure you understand the issue - when an ASP.NET datagrid is
!> !empty, whatever background color set for the header "spreads" to the
!> !whole rectange, much larger then the area the header oocupies once it
!> !has data. I'd like a way to stop the "spreading" so that the header
!> !color is not over-applied to an empty grid.
!> !
!> !Yan-Hong Huang[MSFT] wrote:
!> !
!> !> Hello Matthew,
!> !>
!> !> Thanks for posting in the group.
!> !>
!> !> 1) for changing header color:
!> !> we could use the following in design time:
!> !> <asp
ataGrid ID="DefaultGrid" Runat="server" ShowHeader=True>
!> !> <HeaderStyle Font-Size="14px" Font-Bold="True"
!> BackColor="LightSalmon"></HeaderStyle>
!> !> </asp
ataGrid>
!> !>
!> !> 2) for row colors:
!> !> we could implement the ItemDataBound event for the datagrid.
!> !>
!> !> // event code
!> !> private void dGrid_ItemDataBound(object sender,
!> !> System.Web.UI.WebControls.DataGridItemEventArgs e) {
!> !> // only apply on item and alternating item
!> !> if (e.Item.ItemType == ListItemType.Item ||
!> !> e.Item.ItemType == ListItemType.AlternatingItem)
!> !> {
!> !> // getting the index value ( or any other data cell
!> !> value )
!> !> string sVal = e.Item.Cells[0].Text;
!> !>
!> !> // changing the color or all even rows
!> !> if ((Convert.ToInt32(sVal) == 3)
!> !> {
!> !> e.Item.BackColor = System.Drawing.Color.Red;
!> !> }
!> !> }
!> !> }
!> !>
!> !> You can try this also:
!> !> After binding the dataset to the datagrid.
!> !> just try this piece of code:
!> !> datagrid1.items[3].BackColor=System.Drawing.Color.Red.
!> !>
!> !> Hope it helps.
!> !>
!> !> Best regards,
!> !> Yanhong Huang
!> !> Microsoft Online Partner Support
!> !>
!> !> Get Secure! -
www.microsoft.com/security
!> !> This posting is provided "AS IS" with no warranties, and confers no
!> rights.
!> !>
!> !> --------------------
!> !> !Date: Tue, 12 Aug 2003 11:32:21 -0400
!> !> !From: Matthew Wieder <
[email protected]>
!> !> !User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4)
!> Gecko/20030624 Netscape/7.1 (ax)
!> !> !X-Accept-Language: en-us, en, he
!> !> !MIME-Version: 1.0
!> !> !Subject: Re: Empty DataGrid Formatting
!> !> !References: <
[email protected]>
!> <#
[email protected]>
!> !> !In-Reply-To: <#
[email protected]>
!> !> !Content-Type: text/plain; charset=us-ascii; format=flowed
!> !> !Content-Transfer-Encoding: 7bit
!> !> !Message-ID: <
[email protected]>
!> !> !Newsgroups: microsoft.public.dotnet.framework.aspnet
!> !> !NNTP-Posting-Host: 207.106.112.178
!> !> !Lines: 1
!> !> !Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
!> !> !Xref: cpmsftngxa06.phx.gbl
!> microsoft.public.dotnet.framework.aspnet:167121
!> !> !X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
!> !> !
!> !> !I'm not sure what version of VS you're using, but in mine, property
!> !> !builder doesn't allow setting of the height for the header...
!> !> !anyone else?
!> !> !
!> !> !alien2_51 wrote:
!> !> !
!> !> !> I believe you go into the Property Builder if it's an ASP.NET grid and
!> !> !> explicitily set the Header height....
!> !> !>
!> !> !>
!> !> !> !> !> !>
!> !> !>>Hi - I have a datagrid that has a black header and the rows alternate
!> !> !>>white and gray. The problem is that until items are added to the
!> grid,
!> !> !>>the grid appears as a large black rectangle, which is quite ugly. The
!> !> !>>black area is larger then it is once an item is added. How can I
!> solve
!> !> !>>this problem either by:
!> !> !>>A) Having only the header black and the rest of the empty block white
!> or
!> !> !>>gray (preffered solution)
!> !> !>>B) Having the color gray or white until an item is added and then
!> !> !>>changing to my default template colors - this is less ideal since I
!> !> !>>would aslo then have to keep track of if all times are deleted and I
!> go
!> !> !>>back to the empty state.
!> !> !>>
!> !> !>>thanks!
!> !> !>>
!> !> !>
!> !> !>
!> !> !>
!> !> !
!> !> !
!> !>
!> !>
!> !
!> !
!>
!
!