Why do I get an error when I put inline code in a web control custom atribute?

J

jahles

I have a control that takes an ID (short). In the html where the control is
placed, when I put the following:

<td>
<cc2:logocontrol id="Logocontrol1"
<TiltleID="<%=_somec#variablethatisetearlier%>
runat="server">
</cc2:logocontrol>
</td>

When I run the page, I get an error saying i can't have '<% %>' with server
side controls. How can I pass in a run time variable here? When I try to set
this variable in the code behind for PAGE_LOAD it doesn't seem to have any
affect. I need to be able to set this variable 'on the fly' somewhere!


Thanks in advance
j
 
K

Ken Schaefer

You could create a property in your User Control, and set the property's
value at run time. In the user control you could then have a literal control
(or similar), which is set to the value of the property.

Cheers
Ken

: I have a control that takes an ID (short). In the html where the control
is
: placed, when I put the following:
:
: <td>
: <cc2:logocontrol id="Logocontrol1"
: <TiltleID="<%=_somec#variablethatisetearlier%>
: runat="server">
: </cc2:logocontrol>
: </td>
:
: When I run the page, I get an error saying i can't have '<% %>' with
server
: side controls. How can I pass in a run time variable here? When I try to
set
: this variable in the code behind for PAGE_LOAD it doesn't seem to have any
: affect. I need to be able to set this variable 'on the fly' somewhere!
:
:
: Thanks in advance
: j
:
:
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top