473,378 Members | 1,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Writing HTML <br> code into a panel or placeholder

Hello everyone,

I am in a bit of a dilema trying to write an HTML <br> tag into a panel or
placeholder.

Here is the situation

I have 4 tables that represent 4 levels of data (level4 is linked to a
level3 etc) all the way up to a level 1

Example

Level1
Level2a
Level2b
Level3a
Level3B
Level4a
Level4b
Level2c
I am using a datalist to contain these 4 levels, but I want to recreate a
tree like structure so that the user can easily see what level2's are in a
level1 as well as select a particular level to see its details.

The link buttons work fine but I am unable to get the levels to look right.
So I looked at trying to add a BR tag at the end of each level but it does
not seem to be working.

This is the result that I am getting:

Level1Level2aLevel........

When I look at the View Source on the web page the <br> tags are NOT there.

What am I doing wrong?

I thought about trying to use HtmlTextWriter, but I have NO idea how that
works and the examples in VS are not very explicit.

Any help would be much appreciated... I am even open to other ways to create
this tree like structure.

BTW - I am using VS 2003.

Here is the code that I have created so far for my datalist itemdatabound:

Private Sub dlstMaster_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataListItemEventArgs) Handles
dlstMaster.ItemDataBound
Dim dv As DataRowView = e.Item.DataItem
Dim spacer As New LiteralControl("<br>")
Dim level1linkbutton As New LinkButton
Dim level1panel As PlaceHolder = e.Item.FindControl("Level1Panel")
level1linkbutton.Text = dv("Level1Name")
level1linkbutton.CommandArgument = dv("Level1Id").ToString
level1linkbutton.CommandName = "Level1Click"
level1panel.Controls.Add(level1linkbutton)
level1panel.Controls.Add(spacer)
Dim ds As New DataSet
ds = Session("ds")
If Not dv Is Nothing Then
Dim level2dv As DataView
level2dv = dv.CreateChildView("level2")
Dim row As DataRowView
For Each row In level2dv
Dim level2linkbutton As New LinkButton
level2linkbutton.Text = row("Level2Name")
level2linkbutton.CommandArgument = row("Level2Id").ToString
level2linkbutton.CommandName = "Level2Click"

level1panel.Controls.Add(level2linkbutton)
level1panel.Controls.Add(spacer)
' Now loop through the level 3 details
Dim level3dv As DataView
level3dv = New DataView(ds.Tables("AllLevel3"), "Level2Id =
'" & row("Level2Id").ToString & "'", "Level3Name",
DataViewRowState.CurrentRows)
Dim level3row As DataRowView
For Each level3row In level3dv
Dim level3linkbutton As New LinkButton
level3linkbutton.Text = level3row("Level3Name")
level3linkbutton.CommandArgument =
level3row("Level3Id").ToString
level3linkbutton.CommandName = "Level3Click"
level1panel.Controls.Add(level3linkbutton)
level1panel.Controls.Add(spacer)
' now get the level 4's
Dim level4dv As DataView
level4dv = New DataView(ds.Tables("AllLevel4"),
"Level3Id = '" & level3row("Level3Id").ToString & "'", "Level4Name",
DataViewRowState.CurrentRows)
Dim level4row As DataRowView
For Each level4row In level4dv
Dim level4linkbutton As New LinkButton
level4linkbutton.Text = level4row("Level4Name")
level4linkbutton.CommandArgument =
level4row("Level4Id").ToString
level4linkbutton.CommandName = "Level4Click"
level1panel.Controls.Add(level4linkbutton)
level1panel.Controls.Add(spacer)
Next
Next
Next
End If
End Sub

The problem is that when I add the spacer control (a literal control with
the BR in it) it is not added into the placeholder. I have tried to use a
panel, with the same effect
Jul 21 '05 #1
0 2445

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: fis | last post by:
Hi all, I've problem because there are needed break lines in my texts on the web site but i can't do it :( My pipeline looks like: XMS -> I18N -> XSLT -> HTML I have lot of texts in my...
0
by: George Ter-Saakov | last post by:
I have a composite control. Which has 2 parts. Under some conditions first part must be shown sometimes another. So naturally I used 2 Panel object. And hide one of them. The problem is that...
7
by: Rocky Moore | last post by:
I have a web site called HintsAndTips.com. On this site people post tips using a very simply webform with a multi line TextBox for inputing the tip text. This text is encode to HTML so that no...
5
by: SteveB | last post by:
How can I write a break on Web Form using C#?
0
by: info | last post by:
I have a datalist with ItemTemplate as a part of my control, however every time the ItemTemplate repeats, it inserts a <br>. How do I get it to not insert a <br>? I need it to be a DataList as...
2
by: Winshent | last post by:
I have a multi line text in an admin page on my cms. I am trying to capture carriage returns as and replace them with <p></p> bfore the string gets written to the database. I have tried all...
1
by: Winshent | last post by:
I have a multi line text in an admin page on my cms. I am trying to capture carriage returns as and replace them with <p></p> bfore the string gets written to the database. I have tried all...
0
by: CoreyMas | last post by:
Hello everyone, I am in a bit of a dilema trying to write an HTML <br> tag into a panel or placeholder. Here is the situation I have 4 tables that represent 4 levels of data (level4 is...
7
by: Nathan Sokalski | last post by:
Something that I recently noticed in IE6 (I don't know whether it is true for other browsers or versions of IE) is that it renders <br/and <br></br> differently. With the <br/version, which is what...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.