J'ai encore un p'tit souci...
Voici le code de mon gridview :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" CellPadding="4" ForeColor="#333333" GridLines="None" OnRowDataBound="GridView1_RowDataBound" >
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField DataField="Intitule" HeaderText="Intitule" SortExpression="Intitule" />
<asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
<asp:BoundField DataField="Prix" HeaderText="Prix" SortExpression="Prix" />
<asp:ImageField DataImageUrlField="Photo" DataImageUrlFormatString='ImageHandler.ashx?Photo={0}&MonId=?????' HeaderText="Photo" >
</asp:ImageField>
</Columns>
<EditRowStyle BackColor="#7C6F57" />
<FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#E3EAEB" />
<SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#F8FAFA" />
<SortedAscendingHeaderStyle BackColor="#246B61" />
<SortedDescendingCellStyle BackColor="#D4DFE1" />
<SortedDescendingHeaderStyle BackColor="#15524A" />
</asp:GridView> |
A la ligne 7, il y a ce bout de code :
DataImageUrlFormatString='ImageHandler.ashx?Photo={0}&MonId=?????'
A la place des "?????", je voudrais mettre une variable issue du code behind :
Je l'écris comme ceci :
DataImageUrlFormatString='ImageHandler.ashx?Photo={0}&MonId=<%#(dplid)%>'
Malheureusement, ça ne fonctionne pas ! Dans le reste du code, cette instruction ('<%#(dplid)%>') fonctionne bien (elle me renvoie bien un Int32, la valeur de dplid), mais pas là et je ne comprends vraiment pas pourquoi !
Si vous pouvez m'aider !
NB: j'ai bien fait le databind de mon gridview dans le code behind !
Partager