Solved

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

Posted on 2008-06-15
3
593 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 250 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 250 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

751 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