Sunday, August 28, 2005

Datagrid and its events for items

I was having a hell of a time trying to attach an event to the itemCommand event in datagrid but for some reason the event would not fire !

I was doing all the datasourceing and databinding in the Page_Load() but had neglected to put all the code in that portion under the (!IsPostBack) check !

As soon as I did everything worked fine !

I cant explain exactly why this happened but it has something to do with the grid being re made everytime the page is posted back and due to this events are never attached to it !

remember : if in doubt put code in (!IsPostBack)

If any one can explain this phenom to me , please leave a comment !



Post a Comment

<< Home