Call code-behind method from .aspx site

Cercannaskcer

New Member
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
  • call Image1.DataBind(); Image1.ImageUrl="test.jpg"
  • call OnDataBinding="methodname" and the correct method
  • call ImageUrl='<%# GetImage(1) %> or <%= GetImage(1) %>
Here is some code snippet from my files.ASPX Site:\[code\]<%@ 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\]Code-Behind File\[code\]protected string GetImage(string index){ return "test.jpg";}\[/code\]
 
Back
Top