Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > DataGrid extending with new/insert button

Reply
Thread Tools

DataGrid extending with new/insert button

 
 
Manuel Trunk
Guest
Posts: n/a
 
      11-17-2004
Hi,
I try to develop a server control which inherits from DataGrid and adds a
new/insert button to this grid. This is no problem, but I can't get the event
fired from this new button.
I tried everything, implementing INamingContainer and IPostBackDataHandler,
added the button to the footer of the datagrid and so on. Nothing works.
Anyone who can help me?

Kind regrads,
Manuel

 
Reply With Quote
 
 
 
 
Wolfgang Schwedhelm
Guest
Posts: n/a
 
      11-18-2004
Hi Manuel!

I solved the same Problem.
There is a LinkButton in the second column in the footer.
Try:

private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
DGDataBind();
}
else
{
Table tmp = (Table)DataGrid1.Controls[0];
LinkButton btn = (LinkButton)tmp.Rows[tmp.Rows.Count -
1].Cells[1].Controls[1];
btn.Click += new System.EventHandler(this.cmdAddNew_Click);
}
}
private void cmdAddNew_Click(object sender, System.EventArgs e)
{
//Your Event Code
}
private void DGDataBind()
{
//Your Binding Code
}

Wolfgang

"Manuel Trunk" <Manuel http://www.velocityreviews.com/forums/(E-Mail Removed)> schrieb im
Newsbeitrag news:(E-Mail Removed)...
> Hi,
> I try to develop a server control which inherits from DataGrid and adds a
> new/insert button to this grid. This is no problem, but I can't get the
> event
> fired from this new button.
> I tried everything, implementing INamingContainer and
> IPostBackDataHandler,
> added the button to the footer of the datagrid and so on. Nothing works.
> Anyone who can help me?
>
> Kind regrads,
> Manuel
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compaq Pesario c500 laptop . extending the power button me Computer Support 14 02-14-2010 09:31 PM
Extending datagrid with new/insert button Manuel Trunk ASP .Net Building Controls 6 11-18-2004 02:23 PM
extending datagrid - designer won't work Jon Paugh ASP .Net 3 07-17-2004 01:53 AM
Newbie:Extending an Image Button MattC ASP .Net Web Controls 3 04-28-2004 02:28 PM
Re: Extending DataGrid Francis Shanahan ASP .Net 0 08-26-2003 08:32 PM



Advertisments