Solved

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

Posted on 2007-11-26
2
734 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Icons and Colors for Terms 3 24
Any Third party toll for Integrating chat system on ASP.NET ? 2 34
Syntax Error 2 47
What .NET URL re-routing tool did I use? 2 38
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 …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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, f…

863 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

23 Experts available now in Live!

Get 1:1 Help Now