0
我使用中繼器控制來獲得平均評級從數據庫中使用style標籤內部中繼數據,我想使用平均評分風格標籤的寬度內..如何在ASP
我使用的代碼: 風格= 「高度:15像素;寬度: '」 & <%#的eval(集裝箱, 「DataItem.AverageRating」) 「' %>」 但它給一個錯誤 「的標籤不能很好地形成」 請告訴..
我使用中繼器控制來獲得平均評級從數據庫中使用style標籤內部中繼數據,我想使用平均評分風格標籤的寬度內..如何在ASP
我使用的代碼: 風格= 「高度:15像素;寬度: '」 & <%#的eval(集裝箱, 「DataItem.AverageRating」) 「' %>」 但它給一個錯誤 「的標籤不能很好地形成」 請告訴..
一種方法是你可以在你的代碼隱藏方法,將返回一個字符串 例如
<input <%# WriteWidth(Eval(Container,"DataItem.AverageRating").ToString()) %>
然後在後臺代碼:
protected string WriteWidth(string Width)
{
return string.format(" style='height: 15px, width: {0}px'", Width);
}
你可以使用這個它的工作對我來說
style='<%#"height:15px; width:" + Eval(Container,"DataItem.AverageRating").ToString() +"px;"'