Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
160
WebGrid does not build Columns when AutoGenerateColumns is set to false
posted

Hi,

I have a Page with a WebGrid and an ObjectDataSource. The WebGrid has AutoGenerateColumns set to false. I have defined 2 columns which are both bound (IsBound=true). When the page is shown, the select method of the ObjectDataSource is triggered. It returns a DataView with 4 rows.

1. When I set a breakpoint on the InitializeLayout event handler, the e.Layout.Bands[0].Columns.Count is zero. Is this because I didn't autogenerate the columns? I would expect a value of 2.

2. The WebGrid is not bound to the 4 rows in the Dataview. But when I force a postback by a simple button click the WebGrid gets bound and now in the InitializeLayout event handler the e.Layout.Bands[0].Columns.Count is 2.  Why didn't it bind on the first page load?

thanks,
Jeroen

Parents Reply Children
No Data