Here's a fun one. I'm working on a scheduling system for a fortune 500 company. I'm having a very interesting issue here.
First, I have a datagrid control. It has a variable number of columns which can change depending on whoever the logged in user's settings are. In this case let's imagine the header is like this:
Truck Name | Slot 1 | Slot 2 | Slot 3
Now in the data if a truck is already scheduled for a slot, a code shows up. If the slot is available, I create a link button called Add. So here's what my grid looks like when loaded in page load (excuse the lack of screenshots)
Truck Name | Slot 1 | Slot 2 | Slot 3
Truck 1 B | D | Add
Truck 1 Add | Add | C
Now, because these add buttons are added dynamically to my grid, their events will not fire unless the grid is bound on each postback in page_load. The ASP .NET Event model dictates this and it's a commonly accepted fact.
Here's the tricky part. I have a calendar control on the page that is meant to reload the grid for a different date. The Calendar control's SelectedDate() property is not updated until after Page_Load. So for me to get events working properly AND to get the correct date I seem to be forced to load and bind the datagrid twice. Once in page load and again after the calendar control is updated. (pre_render, wherever).
There must be a more elegant way!
Posted
Thu, Dec 16 2004 9:10 AM
by
Eric Wise