Hi,
I have to web-pages ... with diffeent UltraWebGrids.
In default.aspx sem InitializeLayout does NOT fire when I load up the page,but fires up the first time when I actually LOAD data in it [ correct behaviour ]
in logging.aspx the InitializeLayout fires right away when I Response.Redirect("Logging.aspx") to it from the default.aspx. Why is that ???I'm getting errors in that grid IF it's empty ( no data in database )
This is probably happening because this is located in the PAGE_LOAD:
_logs = TrackingService.GetAllLogs(); //get datasource_wgLogs.DataSource = _logs; //_wgLogs is UltraWebGrid_wgLogs.DataBind();
Where would you put the "GetDateSource and bind" code if not the PAGE_LOAD ?-> The data should be immidety available when the loggin.aspx page loads up!?But if there's no data, the InitializeLayout fires a null reference error ( of course )
I need the InitializeLayout only to fire AFTER some data has been loaded into the grid ...
Please help,EE.
The problem still exists if I put the "Get and bind datasource" code behind a BUTTON ( instead of the PAGE_LOAD ) because the Grid is actualy EMPTY!
so I put this ugly code, so the Initilize_Layout will NOT fire if there's no data in the datasource,
protected void _btnGetLogs_Click(object sender, EventArgs e) { _logs = TrackingService.GetAllLogs(); if (_logs.Count > 0) // if this FALSE, there will be no databinding and hence not entering the Initiliaze_Layout: { _wgLogs.DataSource = _logs; _wgLogs.DataBind(); } }