PDA

View Full Version : DataGrid events


Ted Husted
03-21-2005, 03:53 PM
I bravely snagged Spring.Web from CVS and plugged it into my application.

The DI stuff is working just fine, but my DataGrid ItemCommand events don't seem to fire.

When I reverted to the System.Web.UI.Page, the ItemCommand starting firing again.

Is there a Spring DataGrid that we should use? (I looked but couldn't find one in CVS.)

The DataGrid in play now uses the common idiom of setting most properties in the ASPX, and setting the dataource in the codebehind. On other pages, we started using fully dynamic DataGrids that are constructed by the codebehind.

I'd be happy to donate a very simple example application using a conventional DataGrid and dynamic DataGrid, to demonstrate the problem, if that would help.

-Ted.

Aleks Seovic
03-21-2005, 05:34 PM
Hi Ted,

Current Spring.Web code in CVS is broken and I'm working on the fix.

Basically, view state does not restore properly and events don't fire if dependencies are injected into controls. Problem is still there even if nothing is really injected into controls -- simple recursive iteration over the controls in the form seems to change the state of the controls, which in turn causes view state restoration to fail. Very strange behavior indeed...

It looks like I'll have to remove support for controls DI unless I can find another way to do it. Problem is that I want dependencies to be injected before any page or control events are fired, and that causes the view state/events issue that you ran into.

I'll probably check in the code into CVS later today that fixes the problem but doesn't have controls DI support. Other stuff that Spring Page class gives you is probably more important than controls DI right now.

BTW, I'd love to see your sample app that demonstrates the bug. More examples I have easier this will be to figure out, or at least I hope so :) If you can zip it up and email it to me I'd really appreciate it.

Regards,

Aleks

Aleks Seovic
03-22-2005, 08:02 AM
Ted,

I believe the issue you ran into is fixed now, please try the latest Spring.Web code from CVS and let me know if it works for you.

I had to move controls DI to the beginning of OnLoad event, which means that you cannot use injected properties within OnInit event or before you call base.OnLoad within your OnLoad implementation. If you don't override OnLoad and simply use VS.Net-generated Page_Load method for page and control initialization everything will work fine as well and you can reference injected properties from it.

I will post controls DI docs on the wiki probably some time tomorrow. In the meantime, please let me know if this fix works for you.

Thanks,

Aleks

Ted Husted
03-22-2005, 10:56 AM
Thanks, Aleks.

Yes, the DataGrid events are firing now :)

-Ted.