如何将颜色分配给网格视图 [英] How to assign the color to grid view

查看:70
本文介绍了如何将颜色分配给网格视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在我的应用程序中,我正在使用gridview.我在rowdatabound中设置颜色.它的工作正常.在那个网格中,我将单选按钮列表与某些selectedindexchange事件一起使用.当我选择单选按钮时,网格视图的颜色正在改变.对我来说,触发事件时,GridView的颜色不应更改.有什么方法可以解决这个问题.

在此先感谢

Hi,

In my application I am using the gridview. I am setting the color in the rowdatabound. its working fine. In that grid I am using the radiobuttonlist with some selectedindexchange Event. when I select the radio button the color of the grid view is changing. For me the color of the gridview should not change when the event is fired. Is there any method to solve this problem.

Thanks in Advance

推荐答案

根据条件,您可以选择不显示任何内容.

例如
Depending on the condition you can choose to display none.

E.g.
if (e.Row.RowType == DataControlRowType.DataRow)
{
       e.Row.Attributes["style"] = "display:none";
}




如果要将网格行样式定义为自定义颜色,并且希望与数据无关,则保持不变,

您可以在网格视图定义中尝试以下代码,例如,
Hi,

If you are defining the grid row style to custom colour and want it to be same irrespective of the data,

You can try the below code in the grid view defination like,
(<asp:gridview id="YourGridViewid" runat="server">)



代码:



Code:

<headerstyle backcolor="LightCyan" forecolor="MediumBlue" />

<footerstyle backcolor="LightCyan" forecolor="MediumBlue" />

<rowstyle backcolor="LightCyan" forecolor="DarkBlue" font-italic="true" />

<alternatingrowstyle backcolor="PaleTurquoise" forecolor="DarkBlue">
font-italic="true"/>


</alternatingrowstyle>



希望对您有所帮助.



Hope this helps.


您可以将CSS应用于gridview希望此链接可以对您有所帮助

http://atashbahar.com/post/GridView-makeover-using-CSS.aspx [ ^ ]


http://www.cyberslingers.com/weblog/post/ASPNET-GridView-Themes.aspx [^ ]



http://www.csharpaspnetarticles.com/2009/07/scrollable-gridview- fixed-headers-asp.html [ ^ ]
You can apply CSS to gridview Hope this link may help you

http://atashbahar.com/post/GridView-makeover-using-CSS.aspx[^]


http://www.cyberslingers.com/weblog/post/ASPNET-GridView-Themes.aspx[^]



http://www.csharpaspnetarticles.com/2009/07/scrollable-gridview-fixed-headers-asp.html[^]


这篇关于如何将颜色分配给网格视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆