ASP.Net/HTML Control/BulletList — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 11:53, 26 мая 2010
Use asp:Label to create a bulleted list (VB.net)
<%@ Page Language="VB" %>
<script runat="server">
Sub Button1_Click(sender As Object, e As EventArgs)
Dim fullString, subString As String
Dim startPos, length As Integer
startPos = CInt(TextBox2.Text)
length = CInt(TextBox3.Text)
fullString = TextBox1.Text
subString = fullString.SubString(startPos, length)
Label1.Text = subString
End Sub
Sub Button2_Click(sender As Object, e As EventArgs)
Dim myString As String
Dim myWords As String()
myString = TextBox1.Text
myWords = myString.Split(" ".toCharArray())
" Start bulleted list
Label1.Text = "<ul>"
Dim word As String
For Each word in myWords
Label1.Text = Label1.Text & "<li>" & word & "</li>"
Next word
" End bulleted list
Label1.Text = Label1.Text & "</ul>"
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<p>
<asp:TextBox id="TextBox1" runat="server" TextMode="MultiLine" Width="259px" Height="112px"></asp:TextBox>
</p>
<p>
start:
<asp:TextBox id="TextBox2" runat="server"></asp:TextBox>
</p>
<p>
length:
<asp:TextBox id="TextBox3" runat="server"></asp:TextBox>
</p>
<p>
<asp:Label id="Label1" runat="server"></asp:Label>
</p>
<p>
<asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Show Substring"></asp:Button>
<asp:Button id="Button2" onclick="Button2_Click" runat="server" Text="Split"></asp:Button>
</p>
</form>
</body>
</html>