afficher une image a partir d'un dropdownlist
bonjour:)
je vous explique le contexte
j'enregistre dans ma base de donné des info sur les photo comme ceci
Citation:
photo ( id_photo , chemin , index , id_commande )
j'ai un dropdownlist avec la liste des id_photo qui retourne le chemin
maintenant j'aimerais pouvoir afficher la photo en fonction de la selection du dropdownlist :?
mais le probléme c'est , vous l'avez devinez , e n'y arrive pas
j'utilise un gridview avec un imagefield comme ceci ( méme ci je doute que ce soit l'ideale :aie:)
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| <asp:DropDownList ID="DropDownList1" runat="server" Width="185px" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" DataSourceID="SqlDataSource1" DataTextField="chemin_photo" DataValueField="chemin_photo" AutoPostBack="True">
</asp:DropDownList><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:gavaConnectionString1 %>"
SelectCommand="SELECT [chemin_photo] FROM [photo_of]"></asp:SqlDataSource>
<br />
<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource2" AutoGenerateColumns="False" Height="90px" Width="158px">
<Columns>
<asp:ImageField dataimageurlfield="[chemin_photo]"
>
</asp:ImageField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:gavaConnectionString1 %>"
SelectCommand="SELECT [chemin_photo] FROM [photo_of]"></asp:SqlDataSource>
<br /> |
en gros il n'affiche rien pas de message d'erreur
sinon j'aurai préféré utiliser un bitmap
j'ai essayer ca ( ca ne marche pas , evidemant sinon je serait pas la :calim2:)
Code:
1 2 3 4 5 6 7 8 9
| Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Dim image1 As Drawing.Bitmap
image1 = New Drawing.Bitmap(DropDownList1.Text, True)
End Sub |
en gros j'arrive a rien :help::help: