Solved

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

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem with SelectList in .NET MVC application 1 27
How to read text with RegEx... 2 25
VB.NET Textbox input validation 4 37
Easy filter aspnet 2 24
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 …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

839 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