This is a migrated thread and some comments may be shown as answers.

[Solved] DataBinding event handler not called for control in Template column

1 Answer 122 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dewang Shah
Top achievements
Rank 1
Dewang Shah asked on 25 Jan 2010, 04:21 PM
Hi,

I have a custom control type that implements ITemplate and is added to a GridTemplateColumn. I have added an event handler to the literal control that is part of the custom control.
        public void InstantiateIn(System.Web.UI.Control container) 
        { 
            System.Web.UI.LiteralControl c = new System.Web.UI.LiteralControl(); 
            c.DataBinding += new EventHandler(Button_DataBinding); 
 


The first time the page loads, the event handler gets called. However, on Postback the event handler is not called.

Any ideas?

Thanks,
Dewang

1 Answer, 1 is accepted

Sort by
0
Dewang Shah
Top achievements
Rank 1
answered on 26 Jan 2010, 11:28 AM
You need to call Rebind() in Page_Load.
Tags
Grid
Asked by
Dewang Shah
Top achievements
Rank 1
Answers by
Dewang Shah
Top achievements
Rank 1
Share this question
or