如何添加标题为每个标题列在GridView控件在ASP.NET [英] how to add title for every header column in gridview in ASP.NET

查看:134
本文介绍了如何添加标题为每个标题列在GridView控件在ASP.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ASP.NET,我有一个gridview,我需要把一个标题在每个标题栏,标题会显示在moseover .................. ...............我一定到外地转换为模板列

有些事情是这样的:

 < ASP:BoundField的数据字段=ID_Dossier的HeaderText =ID_Dossier只读=真
  SORTEX pression =ID_Dossier称号=特里尔相提并论identifiant DES卷宗/>

这是我的gridbiew:

 < ASP:GridView控件ID =DossierGV=服务器AllowPaging =真
                            AllowSorting =真的DataSourceID =DossierPF的AutoGenerateColumns =FALSE
                            的DataKeyNames =ID_Dossier>
                          <柱体和GT;
                              < ASP:的TemplateField ShowHeader =FALSE>
                                  <&ItemTemplate中GT;
                                      < ASP:LinkBut​​ton的ID =LinkBut​​ton1=服务器的CausesValidation =FALSE
                                          的CommandName =选择文本=Ajouter称号=Ajouter莱斯信息去融资AUX CE档案>< / ASP:LinkBut​​ton的>
                                  < / ItemTemplate中>
                              < / ASP:的TemplateField>
                              < ASP:BoundField的数据字段=ID_Dossier的HeaderText =ID_Dossier只读=真
                                  SORTEX pression =ID_Dossier称号=特里尔相提并论identifiant DES卷宗/>
                              < ASP:BoundField的数据字段=ID_Entreprise的HeaderText =ID_Entreprise
                                  SORTEX pression =ID_Entreprise/>
                              < ASP:BoundField的数据字段=Date_Depot的HeaderText =Date_Depot
                                  SORTEX pression =Date_Depot/>
                              < ASP:BoundField的数据字段=Type_Etude的HeaderText =Type_Etude
                                  SORTEX pression =Type_Etude/>
                              < ASP:BoundField的数据字段=Dernier_Type的HeaderText =Dernier_Type
                                  SORTEX pression =Dernier_Type/>
                              < ASP:BoundField的数据字段=Eligibile的HeaderText =Eligibile
                                  SORTEX pression =Eligibile/>
                              < ASP:BoundField的数据字段=Fiche_Information的HeaderText =Fiche_Information
                                   />
                              < ASP:BoundField的数据字段=Buletin_Adhesion的HeaderText =Buletin_Adhesion
                                   />
                              < ASP:BoundField的数据字段=Fiche_Renseignment的HeaderText =Fiche_Renseignment
                                   />
                              < ASP:BoundField的数据字段=认证的HeaderText =认证
                                  />
                              < ASP:BoundField的数据字段=ID_Cabinet的HeaderText =ID_Cabinet
                                  SORTEX pression =ID_Cabinet/>
                              < ASP:BoundField的数据字段=Montant_Demander的HeaderText =Montant_Demander
                                  SORTEX pression =Montant_Demander/>
                              < ASP:BoundField的数据字段=绵延的HeaderText =绵延SORTEX pression =绵延/>
                              < ASP:BoundField的数据字段=Porcentage_Taux的HeaderText =Porcentage_Taux
                                  SORTEX pression =Porcentage_Taux/>
                              < ASP:BoundField的数据字段=Nom_Giac的HeaderText =Nom_Giac
                                  SORTEX pression =Nom_Giac/>
                          < /专栏>
                      < / ASP:GridView的>


解决方案

我不认为这是在ASP.NET中的一种方式,但你总是可以做到这一点在CSS只是使用HeaderStyle-的CssClass您的模板。

更新:

好吧,我错了,ASP.NET支持使用此功能,你只需要在你的TemplateField使用HeaderTemplate中。

 < ASP:的TemplateField SORTEX pression =子网的HeaderText =子网>
   <&HeaderTemplate中GT;
       < ASP:标签ID =SubnetHeader工具提示=我提示你=服务器文本=标签>< / ASP:标签>
   < / HeaderTemplate中>   <&ItemTemplate中GT;
       < ASP:标签ID =lblSubnet=服务器文本='<%#绑定(子网)%GT;' >< / ASP:标签>
   < / ItemTemplate中>
< / ASP:的TemplateField>

i'm using ASP.NET , i have a gridview and i need to put a title in every header column , title will show on moseover ................................. do i have to convert the field to TemplateField

some thing like this :

 <asp:BoundField DataField="ID_Dossier" HeaderText="ID_Dossier" ReadOnly="True" 
  SortExpression="ID_Dossier" title="Trier par identifiant des dossiers " />

this is my gridbiew :

 <asp:GridView ID="DossierGV" runat="server" AllowPaging="True" 
                            AllowSorting="True" DataSourceID="DossierPF" AutoGenerateColumns="False" 
                            DataKeyNames="ID_Dossier">
                          <Columns>
                              <asp:TemplateField ShowHeader="False" >
                                  <ItemTemplate>
                                      <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                                          CommandName="Select" Text="Ajouter" title="Ajouter les information de finance aux ce dossier"></asp:LinkButton>
                                  </ItemTemplate>
                              </asp:TemplateField>
                              <asp:BoundField DataField="ID_Dossier" HeaderText="ID_Dossier" ReadOnly="True" 
                                  SortExpression="ID_Dossier" title="Trier par identifiant des dossiers " />
                              <asp:BoundField DataField="ID_Entreprise" HeaderText="ID_Entreprise"  
                                  SortExpression="ID_Entreprise" />
                              <asp:BoundField DataField="Date_Depot" HeaderText="Date_Depot" 
                                  SortExpression="Date_Depot"  />
                              <asp:BoundField DataField="Type_Etude" HeaderText="Type_Etude" 
                                  SortExpression="Type_Etude" />
                              <asp:BoundField DataField="Dernier_Type" HeaderText="Dernier_Type" 
                                  SortExpression="Dernier_Type"  />
                              <asp:BoundField DataField="Eligibile" HeaderText="Eligibile" 
                                  SortExpression="Eligibile" />
                              <asp:BoundField DataField="Fiche_Information" HeaderText="Fiche_Information" 
                                   />
                              <asp:BoundField DataField="Buletin_Adhesion" HeaderText="Buletin_Adhesion" 
                                   />
                              <asp:BoundField DataField="Fiche_Renseignment" HeaderText="Fiche_Renseignment" 
                                   />
                              <asp:BoundField DataField="Attestation" HeaderText="Attestation" 
                                  />
                              <asp:BoundField DataField="ID_Cabinet" HeaderText="ID_Cabinet" 
                                  SortExpression="ID_Cabinet"  />
                              <asp:BoundField DataField="Montant_Demander" HeaderText="Montant_Demander" 
                                  SortExpression="Montant_Demander" />
                              <asp:BoundField DataField="Duree" HeaderText="Duree" SortExpression="Duree" />
                              <asp:BoundField DataField="Porcentage_Taux" HeaderText="Porcentage_Taux" 
                                  SortExpression="Porcentage_Taux" />
                              <asp:BoundField DataField="Nom_Giac" HeaderText="Nom_Giac" 
                                  SortExpression="Nom_Giac" />
                          </Columns>
                      </asp:GridView>

解决方案

I don't think there is a way in ASP.NET, but you can always do it in CSS just use HeaderStyle-CssClass on your template.

UPDATE:

Ok, I was wrong, ASP.NET does support this functionality, you just need use a HeaderTemplate in your TemplateField.

<asp:TemplateField SortExpression="Subnet" HeaderText="Subnet">
   <HeaderTemplate>
       <asp:Label ID="SubnetHeader" ToolTip="My Tip to you" runat="server" Text="Label"></asp:Label>
   </HeaderTemplate>

   <ItemTemplate >  
       <asp:Label ID="lblSubnet" runat="server" Text='<%# Bind("Subnet") %>' ></asp:Label>       
   </ItemTemplate>
</asp:TemplateField>

这篇关于如何添加标题为每个标题列在GridView控件在ASP.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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