Hi,
You do not need to create a new class, just use the Page PreRender event
and add a control to the datagrid.Controls collection
One question though, if you know for sure it will always go there, why not
declare it in the page?
Even if sometimes it's not shown it's easier to declare it alone and use
Visible = false;
Btw, you are getting error below cause Write expect a string, not a Button
instance
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Chris" <no****@devdex.com> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
I think I must be going crazy. All I want to do is add a button to the
bottom of a datagrid which will later run some code for a web based
project. I've created a custom control that inherits from the datagrid
and have added just a single line of code thus;
protected override void Render(HtmlTextWriter output)
{
output.Write(new System.Web.UI.WebControls.Button());
base.Render(output);
}
All looks fine at design time but at runtime I'm getting a cast
exception - what am I missing? Many thanks if you can point out where
I'm going wrong.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!