首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

请教怎么去掉Datagrid列表头的下划线

2012-01-22 
请问如何去掉Datagrid列表头的下划线点击Datagrid列表头可以进行排序,请问如何去掉Datagrid列表头的下划线

请问如何去掉Datagrid列表头的下划线
点击Datagrid列表头可以进行排序,请问如何去掉Datagrid列表头的下划线

[解决办法]
按着习惯来说,去掉下线后一般用户就会认为列是不可以排序的.这就不符合多数人的习惯了.
为什么一定要这么做呢...
[解决办法]
顶一下
[解决办法]
简单一点 <style> a{ text-decoration:none;} </style>
[解决办法]
用CSS
[解决办法]
我记得那种表头就是一个超链接按钮。
可以参考下面这个超链接的去掉下划线地方式,设置一个style就行
<a style= "text-decoration:blink " href=Default.aspx> asdasdasda </a>
[解决办法]
链接样式问题
慕白正解
[解决办法]
<ASP:DATAGRID id= "dg_EnterTainment_ParticularEvent " RUNAT= "server " WIDTH= "870 " CSSCLASS= "Result_DG_Style "
AUTOGENERATECOLUMNS= "False ">
<FOOTERSTYLE CSSCLASS= "Result_DG_FooterStyle " HORIZONTALALIGN= "Center " WRAP= "false "> </FOOTERSTYLE>
<SELECTEDITEMSTYLE CSSCLASS= "Result_DG_SelectItemStyle " WRAP= "true "> </SELECTEDITEMSTYLE>
<EDITITEMSTYLE CSSCLASS= "Result_DG_EditItemStyle " WRAP= "true "> </EDITITEMSTYLE>
<ALTERNATINGITEMSTYLE CSSCLASS= "Result_DG_AlternatingItemStyle " WRAP= "true "> </ALTERNATINGITEMSTYLE>
<ITEMSTYLE CSSCLASS= "Result_DG_ItemStyle " HORIZONTALALIGN= "Center " WRAP= "true "> </ITEMSTYLE>
<HEADERSTYLE CSSCLASS= "Result_DG_HeaderStyle " HORIZONTALALIGN= "Center " WRAP= "false "> </HEADERSTYLE>
<COLUMNS>
<ASP:BoundColumn DataField= "EVENT_KEY " Visible= "False "> </ASP:BoundColumn>
<ASP:TEMPLATECOLUMN HEADERTEXT= "Delete ">
<ITEMTEMPLATE>
<ASP:IMAGEBUTTON ID= "dg_EnterTainment_ParticularEvent_btnDelete " RUNAT= "server " COMMANDNAME= "Delete "
IMAGEURL= "images/delete.gif "> </ASP:IMAGEBUTTON>
</ITEMTEMPLATE>
</ASP:TEMPLATECOLUMN>
<ASP:TEMPLATECOLUMN HEADERTEXT= "Entr No " HeaderStyle-Wrap= "False " HeaderStyle-ForeColor= "#ff99cc " ItemStyle-ForeColor= "Fuchsia "
ItemStyle-Font-Bold= "True ">
<ITEMTEMPLATE>
<asp:LinkButton ID= "Imagebutton3 " TEXT= ' <%#DataBinder.Eval(Container, "DataItem.EVENT_KEY ")%> ' RUNAT= "server " COMMANDNAME= "view " >
</asp:LinkButton>
</ITEMTEMPLATE>
</ASP:TEMPLATECOLUMN>
<ASP:TEMPLATECOLUMN HEADERTEXT= "Event Date ">
<ITEMTEMPLATE>
<UC1:UC_CalendarText id= "dg_EnterTainment_ParticularEvent_txt_EventDate " Runat= "server " top= "0 " left= "150 " TEXT= ' <%#DataBinder.Eval(Container, "DataItem.EVENT_DATE ")%> '>
</UC1:UC_CalendarText>
</ITEMTEMPLATE>
</ASP:TEMPLATECOLUMN>
<ASP:TEMPLATECOLUMN HEADERTEXT= "Place ">


<ITEMTEMPLATE>
<ASP:TEXTBOX id= "dg_EnterTainment_ParticularEvent_txt_Place " MaxLength= "20 " Runat= "server " Width= "80 " CssClass= "TextBoxStyle " Text= ' <%#DataBinder.Eval(Container, "DataItem.PLACE ")%> '>
</ASP:TEXTBOX>
</ITEMTEMPLATE>
</ASP:TEMPLATECOLUMN>
<ASP:TEMPLATECOLUMN HEADERTEXT= "Invc Num ">
<ITEMTEMPLATE>
<ASP:TEXTBOX id= "dg_EnterTainment_ParticularEvent_txt_InvcNum " MaxLength= "20 " Runat= "server " Width= "80 " CssClass= "TextBoxStyle " Text= ' <%#DataBinder.Eval(Container, "DataItem.INVC_NUM ")%> '>
</ASP:TEXTBOX>
</ITEMTEMPLATE>
</ASP:TEMPLATECOLUMN>
<ASP:TEMPLATECOLUMN HEADERTEXT= "Meal Type ">
<ITEMTEMPLATE>
<ASP:DROPDOWNLIST ID= "dg_EnterTainment_ParticularEvent_ddl_MealType " RUNAT= "server " CSSCLASS= "DropDownListStyle ">
<ASP:LISTITEM VALUE= "B "> Breakfast </ASP:LISTITEM>
<ASP:LISTITEM VALUE= "L "> Lunch </ASP:LISTITEM>
<ASP:LISTITEM VALUE= "D "> Dinner </ASP:LISTITEM>
<ASP:LISTITEM VALUE= "O "> Others </ASP:LISTITEM>
</ASP:DROPDOWNLIST>
</ITEMTEMPLATE>
</ASP:TEMPLATECOLUMN>
<ASP:TEMPLATECOLUMN HEADERTEXT= "Particular ">
<ITEMTEMPLATE>
<ASP:TEXTBOX id= "dg_EnterTainment_ParticularEvent_txt_Particular " MaxLength= "50 " Runat= "server " Width= "80 " CssClass= "TextBoxStyle " Text= ' <%#DataBinder.Eval(Container, "DataItem.PARTICULAR ")%> '>
</ASP:TEXTBOX>
</ITEMTEMPLATE>
</ASP:TEMPLATECOLUMN>
<ASP:TEMPLATECOLUMN HEADERTEXT= "Curr ">
<ITEMTEMPLATE>
<ASP:DROPDOWNLIST RUNAT= "server " ID= "dg_EnterTainment_ParticularEvent_Curr " CSSCLASS= "DropDownListStyle "> </ASP:DROPDOWNLIST>
</ITEMTEMPLATE>
</ASP:TEMPLATECOLUMN>
<ASP:TEMPLATECOLUMN HEADERTEXT= "Amt ">
<ITEMTEMPLATE>
<ASP:TEXTBOX id= "dg_EnterTainment_ParticularEvent_txt_Amt " MaxLength= "15 " Runat= "server " Width= "80 " CssClass= "TextBoxNumericStyle " Text= ' <%#DataBinder.Eval(Container, "DataItem.AMT ", "{0:n2} ")%> ' >
</ASP:TEXTBOX>
</ITEMTEMPLATE>
</ASP:TEMPLATECOLUMN>
<ASP:TEMPLATECOLUMN HEADERTEXT= "Local Amt ">
<ITEMTEMPLATE>
<ASP:TEXTBOX id= "dg_EnterTainment_ParticularEvent_txt_LocalAmt " MaxLength= "15 " Runat= "server " Width= "80 " ReadOnly= "True " CssClass= "TextBoxReadOnlyNumericStyle " Text= ' <%#DataBinder.Eval(Container, "DataItem.LOCAL_AMT ", "{0:n1} ")%> ' >
</ASP:TEXTBOX>
</ITEMTEMPLATE>
</ASP:TEMPLATECOLUMN>
<ASP:TEMPLATECOLUMN HEADERTEXT= "Receipt ">
<ITEMTEMPLATE>
<ASP:TEXTBOX id= "dg_EnterTainment_ParticularEvent_txt_Receipt " MaxLength= "6 " Runat= "server " Width= "50 " CssClass= "TextBoxStyle " Text= ' <%#DataBinder.Eval(Container, "DataItem.ATTACHMENT ")%> '>


</ASP:TEXTBOX>
</ITEMTEMPLATE>
</ASP:TEMPLATECOLUMN>
</COLUMNS>
</ASP:DATAGRID>


ItemDataBound事件中给header标题附内容时,应该是对linkbutton附内容所以你设一下样式也可以去掉



[解决办法]
有下划线不是蛮好的嘛,可以提示对其排序,呵呵:)

顶cpp2017(慕白兄) 好强啊,经常非常简练的解答大家的问题,谢谢!
[解决办法]
protected void DataGrid1_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Header) { foreach (TableCell cell in e.Item.Cells) { if (cell.Controls[0] is LinkButton) { ((LinkButton)cell.Controls[0]).Style.Add( "text-decoration ", "none "); } } } }

热点排行