A sound of ventilating breath

i have had the worst experiance i could have for the first time trying to use the DataGrid ButtonColumn click event. the solution was so fustrating so i had to publish it. i stumbled across it some where as a side note that expects every one to know that you are suppose to use the Initialize component to dynamically build the Grids layout.
well i didnt.
if you need to use the datagridName_ItemCommand(object s, DataGridCommandEventArgs e) in a grid that you fabricate dynamically in the Code behind then remember! you must put the rendering function in the
override protected void OnInit(EventArgs e){ block.
unless you do this then the event wont fire up at all. no matter if you use the PushButton type or LinkButton type or if you use the
EnableViewState="True"/"False".
it all boils up to the page life cycle and the place where the button is rendered and connected to its event.

Speak Your Mind

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.