如何確定某個動態創建的asp.net控件的寬度? 例如,我有這樣的代碼:在asp.net中獲取動態創建控件的屬性值
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<encosia:HighslideManager ID="HighslideManager1" runat="server" FadeInOut="true"
OutlineType="RoundedWhite" ControlBar="false" />
<table style="width: 100%; padding-left: 15px; padding-right: 15px;">
<tr>
<td valign="top" style="width: 50%; border-right: dotted 2px White;">
<asp:literal id="litText" runat="server" mode="PassThrough"></asp:literal>
</td>
<td valign="top" style="width: 50%">
<table style="width: 100%;" cellspacing="10">
<tr>
<td valign="top" style="width: 50%;" id="imageTD" runat="server" oninit="imageTD_OnInit">
<asp:literal id="litEmptyText" runat="server" mode="PassThrough"></asp:literal>
<asp:repeater id="Repeater1" runat="server">
<ItemTemplate>
<center>
<encosia:HighslideImage ID="HighslideImage1" runat="server" Width="200px"
ImageUrl='<%# Eval("ImageURL", "images/images/{0}") %>'
FullImageURL='<%# Eval("ImageURL", "images/images/{0}") %>'
AlternateText='Image <%# Container.ItemIndex%>'/>
<asp:Label ID="imageDescriptionLabel"
runat="server" CssClass="longtext"
Text= '<%# CutImageDescText(String.Format("{0}",Eval("Description")),imageTD.Width) %>' />
</center>
</ItemTemplate>
<SeparatorTemplate>
<%# ((Container.ItemIndex % 2) == 1) ? "</td></tr><tr><td valign=\"top\" style=\"width:50%;\">" : "</td><td valign=\"top\" style=\"width:50%;\">"%>
</SeparatorTemplate>
</asp:repeater>
</td>
</tr>
</table>
</td>
</tr>
</table>
我需要計算imageTD的寬度。 我試圖計算其頁面事件的寬度,但此屬性也像其他樣式屬性是空的。 ((( 請幫幫我吧! 謝謝!
試着看,也許你可以在JavaScript中得到它... – 2010-10-20 09:55:36