Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom attribute in UserControl (*.ascx)?

Supposing I have a user control like this

<MyTag:MyWidget runat="server" /> 

I am wondering if I can do something like

<MyTag:MyWidget runat="server" MemberHeight="400" PublicHeight="200" /> 

So that in MyWidget.ascx I can have

<div height="<%=IsLoggedIn ? MemberHeight : PublicHeight%>"> 

or something like that...? Because I want the height to vary in each page that is using this widget.

like image 543
Aximili Avatar asked Mar 08 '11 23:03

Aximili


1 Answers

Add a public property to the UserControl class something like...

 public int MySize { get; set; } 
like image 180
Steve Wellens Avatar answered Sep 24 '22 03:09

Steve Wellens