G
Glenn Owens
I have spent several hours trying to research and/or fix the following
problem:
Environment:
VB.Net 2003
Scenario:
I have a dynamically generated DataGrid (all columns are
templatecolumns added at runtime). One of the columns contains a
custom control. In the InstantiateIn method of my
TemplateColumnFactory I:
1) Create a deep copy instance of the custom control (provided via a
TemplateColumnFactory construction parameter),
2) Add a DataBind event handler for the custom control,
3) Add the control to the templatecolumn.
In the associated DataBind eventhandler (also located in the
TemplateColumnFactory) I raise a Public Shared event which exposes the
DatabBinding of the custom control to the, in this case, aspx
code-behind (web Page - which has already added an EventHandler for
the Shared event).
Control DataBind --> Factory raiseEvent --> aspx EventHandler
This all works great the first time...
Problem:
On each subsequent postback, the aspx EventHandler handles the rasied
event an incremental number of times for each control in the DataGrid
i.e:
First postBack aspx EventHandler handles the raised event twice
Second postback aspx EventHandler handles the raised event three time
and so on...
HELP!!!:
First I really need to understand why this is happening. Second, I
really need to get this fixed quickly.
Thanks,
Glenn
problem:
Environment:
VB.Net 2003
Scenario:
I have a dynamically generated DataGrid (all columns are
templatecolumns added at runtime). One of the columns contains a
custom control. In the InstantiateIn method of my
TemplateColumnFactory I:
1) Create a deep copy instance of the custom control (provided via a
TemplateColumnFactory construction parameter),
2) Add a DataBind event handler for the custom control,
3) Add the control to the templatecolumn.
In the associated DataBind eventhandler (also located in the
TemplateColumnFactory) I raise a Public Shared event which exposes the
DatabBinding of the custom control to the, in this case, aspx
code-behind (web Page - which has already added an EventHandler for
the Shared event).
Control DataBind --> Factory raiseEvent --> aspx EventHandler
This all works great the first time...
Problem:
On each subsequent postback, the aspx EventHandler handles the rasied
event an incremental number of times for each control in the DataGrid
i.e:
First postBack aspx EventHandler handles the raised event twice
Second postback aspx EventHandler handles the raised event three time
and so on...
HELP!!!:
First I really need to understand why this is happening. Second, I
really need to get this fixed quickly.
Thanks,
Glenn