Solved

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

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

785 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