WebBuilder451
7/23/2009 1:39:00 PM
i thought i was doing that: here is my code
protected override void RenderContents(HtmlTextWriter output)
{
var t = new Table();
var tds = new TableCell[Rows, Cols];
for (int i = 0; i < Rows; i++)
{
t.Rows.Add(new TableRow());
for (int j = 0; j < Cols; j++)
{
tds[i, j] = new TableCell { Text = "*" }; // create
an extended table cells with an object initilizers and events
tds[i, j].Width = 50;
t.Rows[i].Cells.Add(tds[i, j]);
tds[i, j].ForeColor = (j % 2).Equals(0) ?
System.Drawing.Color.Green : System.Drawing.Color.Red;
}
}
output.Write(t);
}
what this gets me is, and i think i understand why:
System.Web.UI.WebControls.Table
still not sure what i need to override the rows, cells, table?
--
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)
kes
"Erjan Gavalji" wrote:
> Hi,
>
> The server control output is done in two ways. If you need a specific HTML
> to be output, you should override the Render method and write the HTML to
> the HtmlTextWriter.
> On the other hand, if you just need some additional functionality over the
> HTMLTable control, you could either
> - write a class that inherits from it and modify the properties,
> - or you could use an HTMLTable control as a member of your class and use an
> override of the CreateChildControls method.
>
> The first approach is the most powerful one, you have control over anything,
> but it is of course slower.
>
> Cheers,
> Erjan Gavalji
> Telerik
>
> "WebBuilder451" <WebBuilder451@discussions.microsoft.com> wrote in message
> news:7B68BADE-7F6C-4DF0-9576-65CC809D38A1@microsoft.com...
> > i'm looking for a simple example of a server control that just dumps a
> > table
> > of x rows and y columns. I am new to server controls, can output a text
> > value
> > with other properties seen in the designer and i can actually build the
> > table, but am having a little trouble getting output. The best i've got so
> > far is the default tostring method that identifies the table control type.
> > --
> > (i''ll be asking a lot of these, but I find C# totally way cooler than vb
> > and there''s no go''n back!!!)
> > thanks (as always)
> >
> > kes
>
>