jagguy
asked on
inner html and asp.net
i want to just click on a button and more html code is added to my webpage from code behind .
this works but when i click on button i want the one.InnerHtml to repeat so i get another hello on every button click
<div id="one" Runat="server" ></div>
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim a As String
one.InnerHtml = "<h2>hello</h2><br>asas"
End Sub
how do i keep displaying another message from above?
this works but when i click on button i want the one.InnerHtml to repeat so i get another hello on every button click
<div id="one" Runat="server" ></div>
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim a As String
one.InnerHtml = "<h2>hello</h2><br>asas"
End Sub
how do i keep displaying another message from above?
ASKER
ok but how do i get different text to display in label or any any control i use to display text?
the text will go where label3 is
one.InnerHtml += "<br/> <br/> <div class='sidebox1'><div class='boxhead1'><h2>Teach er Version</h2></div>" & _
"<div class='boxbody1'><asp:Labe l ID='Label13' runat='server' Text='Label'>" & _
"</asp:Label><br/> <br/> </div> </div>"
the text will go where label3 is
one.InnerHtml += "<br/> <br/> <div class='sidebox1'><div class='boxhead1'><h2>Teach
"<div class='boxbody1'><asp:Labe
"</asp:Label><br/> <br/> </div> </div>"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
it works fine
Private Sub LoadGrid()
Dim count, i As Integer
Dim a As String
a = "hello wprld"
' one.InnerHtml = "<h2>hello</h2><br>asas"
Dim da As New SqlDataAdapter
Dim command As SqlCommand
command = New SqlCommand
command.CommandText = " SELECT name,date,comment from blog order by date desc"
command.Connection = Myconn
da.SelectCommand = command
da.Fill(ds, "blog")
count = ds.Tables(0).Rows.Count
For i = 0 To count - 1
one.InnerHtml += "<br/> <br/> <div class='sidebox1'><div class='boxhead1'><h2>Teacher Version</h2></div>" & _
"<div class='boxbody1'><br/>" & ds.Tables(0).Rows(i).Item(2) & "<br/> <br/> </div> </div>"
Next
End Sub
Ok, i am not a vb programmer so didnt know += works in vb. anyways for your string concatanation you should use the StringBuilder class as it offers better performance.
http://www.c-sharpcorner.c om/UploadF ile/mahesh /WorkingWi thStringsP 3112320050 21723AM/Wo rkingWithS tringsP3.a spx
http://www.c-sharpcorner.c
one.InnerHtml += "<h2>hello</h2><br>asas"
Anurag