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

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
 
J

Jared

ruskie, add a pound and see if it works. Make sure you call the databind
method on your user control on a parent control.

<%# %>
 
S

Sayed Hashimi

Ruskie,

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

sayed
 
R

ruskie

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top