Can't set tag value using c# codebehind on aspx page
Posted on 2010-11-29
Hi, I have a custom .ascx control and would like to set one of it's properties using code. In the .aspx I have this:
<uc1:CustomContent ID="bunchOfContent" runat="server" contentPayload='<%# getRegionID() %>' />
In the codebehind I have:
public partial class Region : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
public string getRegionID()
//return "region_" + Request["region"];
However, the value I want is not populated and the code is not invoked (breakpoints are not triggered).
What am I doing wrong? I've tried various changes like changing the quotes from " to ' to no quotes at all. Also I've used <%= instead of <%# but no luck. Thanks!