Solved

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

Posted on 2008-06-15
3
583 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
3 Comments
 
LVL 11

Accepted Solution

by:
anuragal 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now