Solved

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

Posted on 2007-11-26
2
738 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_
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying 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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
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.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

691 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