Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to add HTML <BR> spaces when you add a dynamic button to Accordion Pane

Posted on 2008-06-15
3
Medium Priority
?
600 Views
Last Modified: 2012-05-05
Ok I have an Accordion Panel in my VB.NET (asp/web) project. I dynamically add a number of buttons and labels with the following code (amount defined my data in SQL):

I am populating the Accordion dynamically using SQL DB data during the Page_Load server event. Buttons are added to the pane like this:

   Private Sub addBtn(ByVal acp As AjaxControlToolkit.AccordionContentPanel, ByVal btnLabel As String)
        'Adds a button to an Accordion Content Panel
        Dim btn As New Button
        btn.Text = btnLabel
        acp.Controls.Add(btn)
        Dim myLBL as new Label
        mylbl.text = mDate.tostring 'Date from var passed in via SQL
        AddHandler btn.Click, AddressOf BtnClick
    End Sub

I have a list of jobs with a jobID, I have the jobID appear in a button added just as yours on my accordion. However I also add the date of the job as a label next to each button. This works, buttons and labels get added except they are exactly after the previous control so the layout looks a mess. What I want is all the buttons going down on the left and the date label to its corresponding buttons right.

I think this can be done if I was able to addin a HTML <BR> after each control is added to the HTML but how do I do this, is there a control for just HTML, how do I add this dynamically, can anyone tell me a better way, perhaps using styles, although even then im unsure how to go about it.

Any help appreciated. Thanks in advance.

James.
0
Comment
Question by:Steve_Buck
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 11

Accepted Solution

by:
Anurag Agarwal earned 1000 total points
ID: 21788516
What you can do is add whole HTML into this acp.

First add HTMLTable then TR & TD. For all this you will find corresponding HTML Controls under System.UI.HtmlControls namespace.

this way you will able to add each button & label combination on different  TD

Anurag
0
 
LVL 14

Assisted Solution

by:ajitha75
ajitha75 earned 1000 total points
ID: 21788626
You can insert a break tag as below

        HtmlGenericControl breakctl = new HtmlGenericControl();
        breakctl.InnerHtml = "<br/";
        pnltest.Controls.Add(breakctl);
0
 

Author Comment

by:Steve_Buck
ID: 21795106
Thanks Guys,

This sorted me out! :D
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
The most up-to-date version of this article is on my Blog https://iconoun.com/blog/
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question