affichage des images dans un repeater
Bonjour, j'ai un repeater dans ma page aspx :
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
<div>
<table id="tablePhotos" class="formulaire">
<tr>
<td>
Nom de l'image :
</td>
<td>
<asp:TextBox ID="txtNameImg" MaxLength="50" runat="server" CssClass="txt"></asp:TextBox>
</td>
<td>
Uploader l'image :
</td>
<td>
<asp:FileUpload ID="ImageUpload" runat="server" CssClass="txt" />
</td>
<td>
<asp:Button ID="btnTelecharger" Text="Télecharger" CssClass="button" runat="server"
OnClick="btnTelecharger_Click" />
</td>
</tr>
<tr>
<td colspan="5">
<asp:Label ID="lblresultFile" runat="server" Visible="false" Font-Bold="true"></asp:Label>
</td>
</tr>
</table>
</div>
<div>
<asp:Repeater runat="server" ID="repeatPhotos">
<ItemTemplate>
<span style="float: left; width: 130px;">
<asp:ImageButton ImageUrl='<%# Eval("Chemin") %>' ID="imgPhoto" runat="server" alt=""
Style="width: 100px; height: 100px; cursor: pointer" OnClientClick="return LoadDiv(this.src);" /></span>
</ItemTemplate>
</asp:Repeater>
<div id="divBackground" class="modal">
</div>
<div id="divImage">
<table style="height: 100%; width: 100%">
<tr>
<td valign="middle" align="center">
<img id="imgLoader" alt="" src="images/loader.gif" />
<img id="imgFull" alt="" src="" style="display: none; height: 500px; width: 590px" />
</td>
</tr>
<tr>
<td align="center" valign="bottom">
<input id="btnClose" type="button" value="Fermer" onclick="HideDiv()" class="button" />
</td>
</tr>
</table>
</div>
</div> |
Quand je clique sur le bouton consulter de ma gridview :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| protected void listeStations_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Consulter")
{
//remplir details/paiement/echange/corresps
//activer details panel
int id = Convert.ToInt32(e.CommandArgument);
HiddenFiltre.Value = id.ToString();
lblresult.Text = "";
chargerDonnees(id.ToString());
fillGridCorresps(id.ToString());
filleRepeatPhoto(id.ToString());
}
} |
les deux methodes chargerDonnees(id.ToString());fillGridCorresps(id.ToString()); s'executent avec succes
MAis la methode filleRepeatPhoto(id.ToString()); s"execute mais mes images ne s"affichent que si je clique sur le bouton telecharger.
Code:
1 2 3 4 5 6 7 8 9 10 11
| private void filleRepeatPhoto(string id)
{
string queryPhoto = "SELECT * FROM Photos WHERE ID = " + id;
SqlDataAdapter da = new SqlDataAdapter(queryPhoto, connection);
DataTable dt = new DataTable();
da.Fill(dt);
repeatPhotos.DataSource = dt;
repeatPhotos.DataBind();
} |
vous avez une idee ?