• λ我爱Aspx >> Asp.Net >> 在ASP.NET 2.0中使用样式、主题和皮肤
  • 在ASP.NET 2.0中使用样式、主题和皮肤

  • :  Դ:天极开发  :2007-3-16 20:25:37  ؼ:.net,asp.net,asp
  • 在分析ASP.NET页面的时候,在System.Web.UI.HtmlControls.HtmlControl类中,样式信息被填充到CssStyleCollection类型的Style属性。这个属性本质上是一个字典,它把控件的样式暴露为每个样式属性键的按字符串索引的值集合。例如,你可以使用下面的代码设置和检索HtmlInputText服务器控件的width样式属性:

    <script language="VB" runat="server" >Sub Page_Load(Sender As Object, E As EventArgs)MyText.Style("width") = "90px"Response.Write(MyText.Style("width"))End Sub</script><input type="text" id="MyText" runat="server"/>

    下面的例子显示了如何编程使用Style集合属性来控制HTML服务器控件的样式:

    <script language="VB" runat="server">Sub Page_Load(Src As Object, E As EventArgs)Message.InnerHtml &= "<h5>Accessing Styles...</h5>"Message.InnerHtml &= "The color of the span is: " & MySpan.Style("color") & "<br>"Message.InnerHtml &= "The width of the textbox is: " & MyText.Style("width") & "<p>"Message.InnerHtml &= "MySelect's style collection is: <br><br>"Dim Keys As IEnumeratorKeys = MySelect.Style.Keys.GetEnumerator()Do While (Keys.MoveNext())Dim Key As StringKey = CStr(Keys.Current)Message.InnerHtml &= "<li>  "Message.InnerHtml &= Key & "=" & MySelect.Style(Key) & "<br>"LoopEnd SubSub Submit_Click(Src As Object, E As EventArgs)Message.InnerHtml &= "<h5>Modifying Styles...</h5>"MySpan.Style("color") = ColorSelect.ValueMyText.Style("width") = "600"Message.InnerHtml &= "The color of the span is: " & MySpan.Style("color") & "<br>"Message.InnerHtml &= "The width of the textbox is: " & MyText.Style("width")End Sub</script>
    Ҷƪл˵?
  • һƪASP.NET中利用VWD操作数据库
    һƪ在ASP.NET 2.0中建立站点导航层次