ASP.Net/User Control and Master Page/BulletList
Версия от 15:30, 26 мая 2010; (обсуждение)
User control: bullet list
<%@ Register
TagPrefix="My"
TagName="BulletList"
Src=".\BulletList.ascx"
%>
<script runat=server>
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)
If Not IsPostBack Then
BL1.AddBullet("Circle", "An item in the list.")
BL1.AddBullet("Circle", "Another item in the list.")
BL1.AddBullet("Circle", "Third item in the list.")
End If
End Sub
Sub SubmitBtn_Click(Sender As Object, E As EventArgs)
BL1.ClearList()
End Sub
</script>
<html>
<BODY TEXT="black" LINK="darkred" VLINK="darkred" ALINK="red" LEFTMARGIN="40" TOPMARGIN="40">
<form runat="server">
<Font Face="Tahoma">
<My:BulletList
id="BL1"
runat="server"
Caption="Sample Bullet List"
/>
<BR><BR>
<asp:button
id="butOK"
text="Clear List"
Type="Submit"
OnClick="SubmitBtn_Click"
runat="server"
/>
</Font>
</form>
</body>
</html>
<%--
<script language="VB" runat="server">
Public WriteOnly Property Caption() As String
Set
lbl1.Text = value & "<BR><UL>"
End Set
End Property
Public Sub AddBullet (BulletType, BulletText)
lbl2.Text = lbl2.Text & "<LI Type=" _
& """" & BulletType & """>" _
& BulletText
End Sub
Public Sub ClearList ()
lbl2.Text = ""
End Sub
</script>
<asp:Label
id="lbl1"
runat="server"
Text="<UL>"
/>
<asp:Label
id="lbl2"
runat="server"
/>
<asp:Label
id="lbl3"
runat="server"
Text="</UL>"
/>
--%>