Linker une colonne dans un gridview
Hi all,
Je souhaiterais transformer une colonne de mon grid view (ou en ajouter une) pour qu'elle ouvre une nouvelle page internet en fonction de la ligne sur laquelle on clique
Voici comment je rempli mon gridview (code-behind)
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| Sub FillGridView()
'database connexion
myConnection = New SqlConnection("...")
myConnection.Open()
mysqldataadapter = New SqlDataAdapter("SELECT ID,vchBLASTDESC,bInsertEmailID,bSent,bTested,dtInsertDate FROM SI ORDER BY ID DESC", myConnection)
dr = mysqldataadapter.SelectCommand.ExecuteReader()
GridView1.DataSource = dr
GridView1.DataBind()
myConnection.Close()
End Sub |
et comment je le cree
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| <asp:gridview Font-Size="11px" ID="Gridview1"
runat="server" HorizontalAlign="Center" BackColor="White"
BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" CellPadding="3" ForeColor="Black"
GridLines="Vertical" AutoGenerateColumns="False" AllowSorting="True" AutoGenerateEditButton="True" >
<FooterStyle BackColor="#CCCCCC"></FooterStyle>
<Columns>
<asp:BoundField DataField="ID" SortExpression="ID" HeaderText="ID">
<ItemStyle ForeColor="Black"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="vchBlastDesc" SortExpression="vchBlastDesc" HeaderText="vchBlastDesc">
<ItemStyle ForeColor="Black"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="bInsertEmailID" SortExpression="bInsertEmailID" HeaderText="bInsertEmailID">
<ItemStyle ForeColor="Black" HorizontalAlign="Center"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="bSent" SortExpression="bSent" HeaderText="bSent">
<ItemStyle ForeColor="Black" HorizontalAlign="Center"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="bTested" SortExpression="bTested" HeaderText="bTested">
<ItemStyle ForeColor="Black" HorizontalAlign="Center"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="dtInsertDate" HeaderText="dtInsertDate">
<ItemStyle ForeColor="Black" Wrap="False" HorizontalAlign="Center"></ItemStyle>
</asp:BoundField>
</Columns>
<SelectedRowStyle BackColor="#000099" ForeColor="White" Font-Bold="True"></SelectedRowStyle>
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center"></PagerStyle>
<HeaderStyle BackColor="Black" ForeColor="White" Font-Bold="True"></HeaderStyle>
<AlternatingRowStyle BackColor="#CCCCCC"></AlternatingRowStyle>
</asp:gridview> |
Le probleme est que je ne vois pas comment generer cet evenement avec des Boundfield...
Merci d'avance