2012-04-18 72 views
1

下午好取決於結果列,我有一個GridView(在GridView的簡歷)改變超鏈接asp.net中的GridView

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
     DataKeyNames="IDEntretien,Expr2,Expr3" DataSourceID="SqlDataSource12" 
     EnableModelValidation="True" BackColor="White" BorderColor="#999999" 
     BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical"> 
     <AlternatingRowStyle BackColor="Gainsboro" /> 
     <Columns> 
      <asp:BoundField DataField="IDEntretien" HeaderText="IDEntretien" 
       InsertVisible="False" ReadOnly="True" SortExpression="IDEntretien" 
       Visible="False" /> 
      <asp:BoundField DataField="IDPersonne" HeaderText="ID" 
       SortExpression="IDPersonne" /> 
      <asp:BoundField DataField="dtmDate" HeaderText="Date" 
       SortExpression="dtmDate" DataFormatString="{0:d}" /> 
      <asp:BoundField DataField="strNom" HeaderText="Projet" 
       SortExpression="strNom" /> 
      <asp:HyperLinkField DataNavigateUrlFields="IDEntretien" 
       DataNavigateUrlFormatString="ActionASG.aspx?IDEntretien={0}" HeaderText="ASG" 
       Text="ASG" /> 
      <asp:HyperLinkField DataNavigateUrlFields="IDEntretien" 
       DataNavigateUrlFormatString="ActionAEPP.aspx?IDEntretien={0}" HeaderText="AEPP" 
       Text="AEPP" /> 
     </Columns> 
     <FooterStyle BackColor="#CCCCCC" ForeColor="Black" /> 
     <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" /> 
     <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" /> 
     <RowStyle BackColor="#EEEEEE" ForeColor="Black" /> 
     <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" /> 
    </asp:GridView> 
<asp:SqlDataSource ID="SqlDataSource12" runat="server" 
     ConnectionString="<%$ ConnectionStrings:BE Intranet 2009 01 %>" 
     SelectCommand="SELECT Entretien.IDEntretien, Entretien.IDConseiller, Entretien.IDPersonne, Entretien.dtmDate, Entretien.memCommentaires, Entretien.IDProjet, Projet.strNom, Conseiller.strNom AS Expr1, Conseiller.IDConseiller AS Expr2, Projet.IDProjet AS Expr3 FROM Entretien INNER JOIN Conseiller ON Entretien.IDConseiller = Conseiller.IDConseiller INNER JOIN Projet ON Entretien.IDProjet = Projet.IDProjet WHERE (Entretien.IDPersonne = @IDPersonne)"> 
     <SelectParameters> 
      <asp:QueryStringParameter Name="IDPersonne" QueryStringField="IDP" /> 
     </SelectParameters> 
    </asp:SqlDataSource> 

我希望,當結果出現在列項目 - ASG(從表謨。 strNom)例如它變成一個HyperLinkField,它將引用一個頁面「ActionASG.aspx?IDEntretien = {0}」。 如果結果發生變化,例如AEPP,它會引用「ActionAEPP.aspx?IDEntretien = {0}」。 現在,列如下: 因此應該改變它。 ??? Datanavigateurlfields =「strNom」根據內容而變化,它指的是一個非常特定的頁面。

我只是在C#程序,我希望我很清楚。 在所有情況下,非常感謝。

leerickx

回答

0

的訪問可以根據你的鏈接按鈕

+0

的數據網格和變化INT URL的datarowbound事件網格列謝謝你的軌道 – leerickx 2012-04-18 11:55:23