I am facing a problem like this: I have it in HTML page:
<div class="bar bar-success" style="width:80%;"></div>
BUT I'd like to use this 80% comming from a database.
so I'd tried this:
<div id="Percent" runat="server" class="bar bar-warning" style='width: <%# DataBinder.Eval(Container.DataItem, "number") %> %'>
But It didn't work. Can anyone help me to save my problem?
You will need to remove runat attribute from here if you want to set the inline width like below:
<div id="Percent" class="bar bar-warning" style='width: <%# DataBinder.Eval(Container.DataItem, "number") %> %'>
Otherwise you can set it from code behind:
<div id="Percent" runat="server" class="bar bar-warning" >
Percent.Style.Add("width", "YourDatabaseValue");