Reputation: 61
I am using repeater control to get average rating from database and I want to use that average rating inside style tag for width..
I am using the code as: style="height:15px; width:'" & <%# Eval(Container,"DataItem.AverageRating")"' %>" but it is giving an error "tag not well formed" please tell..
Upvotes: 0
Views: 339
Reputation: 1193
you can use this its worked for me
style='<%#"height:15px; width:" + Eval(Container,"DataItem.AverageRating").ToString() +"px;"'
Upvotes: 2
Reputation: 411
one way is you can make a method in your code-behind that will return a string e.g
<input <%# WriteWidth( Eval(Container,"DataItem.AverageRating").ToString() ) %>
then in the code-behind:
protected string WriteWidth(string Width)
{
return string.format(" style='height: 15px, width: {0}px'", Width);
}
Upvotes: 0