English 中文(简体)
如何在 ASP. NET 的网格视图中为每个页眉列添加标题 。
原标题:how to add title for every header column in gridview in ASP.NET

i m 使用 ASP.NET, 我有一个网格视图, 我需要在每个标题栏中加一个标题, 标题将显示在 moseover. htm 。 需要我将字段转换为模板字段吗?

有些事情是这样的:

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

这是我的网友:

 <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>
问题回答

我不认为ASP.NET有办法, 但你可以在 CSS 中总是使用标题Style-CsClass 在你的模板上。

更新:

好吧,我错了, ASP. NET 支持此功能, 您只需要在模板字段中使用一个头板 。

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




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签