i want to call a method from a code-behind file. I already read all threads/posts etc. but it don't work!
I tried to
Here is some code snippet from my files.
ASPX Site:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Abstimmung.aspx.cs" Inherits="Schulsprecher.Abstimmung" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
.
.
<form id="form1" runat="server">
.
.
<asp:Image ID="Image1" runat="server" Width="250px" Height="300px" ImageUrl='<%# GetImage(1) %>' />
Code-Behind File
protected string GetImage(string index)
{
return "test.jpg";
}
If you can change it to normal html image tag, you can do this
<img ID="Image2" width="250" height="300" src='<%= GetImage("1") %>' />
Is it mandatory you should use <asp:Image />
? I tried that with no success