Problem: <%= %> is not evaluated..

  • Thread starter Thread starter ruskie
  • Start date Start date
R

ruskie

I created a user control with two public properties and drop it to an aspx
page as the following

<uc1:myUserControl
id="myUserControl1"
runat="server"
MyProperty1="<%= this.MyVar1 %>"
MyProperty2="<%= this.MyVar2 %>" >
</uc1:myUserControl>

Why the "<%= this.MyVar1 %>" and "<%= this.MyVar2 %>" are not evaluated and
returned as raw string instead?
Thanks
 
ruskie, add a pound and see if it works. Make sure you call the databind
method on your user control on a parent control.

<%# %>
 
Ruskie,

The server side directives will not evaluate unless you call the
databind method on the user control. Did you do that?

sayed
 
I added a pound sign then call Page.DataBind in the parent page. And it
works, thanks for all suggestion. My problem solved.
 
Back
Top