Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Why do I get an error when I put inline code in a web control custom atribute?

Reply
Thread Tools

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

 
 
jahles
Guest
Posts: n/a
 
      08-28-2003
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


 
Reply With Quote
 
 
 
 
Ken Schaefer
Guest
Posts: n/a
 
      08-28-2003
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

"jahles" <(E-Mail Removed)> wrote in message
news:bijk51$c0g$(E-Mail Removed)...
: 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
:
:


 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      08-28-2003
It could work if you'd use databinding syntax:

<TitleID='<%#variable%>'

(note single quotes)

and it is evaluated/set when DataBind is called either for the Page,
containing control, or this control.

--
Teemu Keiski
MCP,Designer/Developer
Mansoft tietotekniikka Oy
http://www.mansoft.fi

AspInsiders Member, www.aspinsiders.com
ASP.NET Forums Moderator, www.asp.net
AspAlliance Columnist, www.aspalliance.com

"jahles" <(E-Mail Removed)> kirjoitti viestissä
news:bijk51$c0g$(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
custom web controls and conversion to inline code Lefty ASP .Net Building Controls 2 06-17-2005 05:05 PM
custom web controls and conversion to inline code Lefty ASP .Net Web Controls 3 06-17-2005 02:22 AM
Custom Control that accepts Inline Code JWhitted ASP .Net Building Controls 2 11-08-2004 11:10 PM
Custom Control That Accepts Inline Code =?Utf-8?B?SldoaXR0ZWQ=?= ASP .Net 1 11-02-2004 08:33 PM



Advertisments