all groups > asp.net building controls > may 2004 >
You're in the

asp.net building controls

group:

Setting user control property dynamically?


Setting user control property dynamically? Dave
5/27/2004 6:51:02 AM
asp.net building controls: Hi I created a user control that has a property that accepts a url ("NavUrl")..

I tried to set the value as follows directly in the aspx page where strLink would be a link.

<uc1:mycontrol id="mycontrol2" runat="server" HtmlContent="html stuff goes here." ImgUrl="myimage.gif" NavUrl="<%Response.Write(strLink);%>"></uc1:mycontrol

Literal content ('">') is not allowed within a 'ASP.mycontrol_ascx'

Re: Setting user control property dynamically? Natty Gur
5/28/2004 4:36:51 AM
HI,


That should work :

Page code :

protected string s()
{
return "\"natty\"";
}


ASPX :
<form id="Form1" method="post" runat="server">
<uc1:a id="A1" URL=<%Response.Write(s());%> runat="server"></uc1:a>
</form>


generate HTML :
<uc1:a id="A1" URL="natty" runat="server"></uc1:a>

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377


*** Sent via Developersdex http://www.developersdex.com ***
AddThis Social Bookmark Button