Re: Problem with Event handlers for Dynamic created Controls in DatGri



A few things come to mind:

*Why do you need to dynamically add the linkbutton to the datagrid?
Why can't you place the linkbutton into the datagrid at design time and
then simply set its visibility based on the situtation? Handling
events for controls added at runtime can be tricky as you need to pay
close attention to the sequence of page and control events.

*Is there anywhere in your code or tags where you specify that the
onItemCommand event for the datagrid will be handled by your procedure
datagrid1_ItemCommand?

*Is the viewstate on your datagrid enabled?

*If you intend to trap and process the click event for your linkbutton
in the datagrid's ItemCommand event, why are you assigning a different
event handler (lButton_Click) to handle it?

*At what point in the page are you binding data to the datagrid and how
often? Are you rebinding with each postback?

Bill E.
Hollywood, FL

.