Solved

how to generate an html table and add it into a panel.

Posted on 2007-11-26
2
731 Views
Last Modified: 2008-02-01
hi experts,
i have a panel called pInci,

i'd like to add it a complete table generated by a controller with the method GetAlgo_Inci();
i wonder what 's the best maner? with literal controls or with htmltable?

this is how i'd like to add my new generated table.
pInci.Controls.Add(Controller_.GetAlgo_Inci());


how would be my method GetAlgo_Inci()? what do i have to return if i want to use
html controls in order to add the complete HtmlTable to Controls of my Panel ?

Class Controller
....
public .....  GetAlgo_Inci(){                   <-  what type to return,
 
    Table t = new Table();
    HtmlTableRow tr = new ...
    ...................                                      <- add tr to t?  
}


how you see what i need experts.
thanks in advance.
0
Comment
Question by:toshi_
2 Comments
 
LVL 4

Accepted Solution

by:
rallsaldo earned 400 total points
ID: 20349725
Hi,

You could use System.Web.UI.WebControls and the return a Table object:

public Table GetAlgo_Inci()
{
        Table t = new Table();
        TableRow tr = new TableRow();
        TableCell tc = new TableCell();
        tr.Cells.Add(tc);
        t.Rows.Add(tr);
        return t;
}

Then you can add the returned table to your panel:

Table t = new Table();
t = Controller.GetAlgo_Inci();
MyPanel.Add(t)

I hope that helps,
R
0
 
LVL 7

Assisted Solution

by:nisarkhan
nisarkhan earned 100 total points
ID: 20349892
or the easiest  and  also easy to maintain option is:

public String GetAlgo_Inci()
{
        return "<table width='100%'><tr><td>something</tr></td>";
}
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

758 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

19 Experts available now in Live!

Get 1:1 Help Now