Don’t Fight the .Net GridView
The .Net GridView prefers to work through DataSources. I tried to use old style Fill dataset, then DataBind() and it simply doesn’t play well with Editing.
In addition, the ObjectDataSource.DataObjectTypeName is riculously underpowered. This version doesn’t get types of inner classes. It uses System.Web.Compilation.BuildManager.GetType instead of System.Type.GetType.
System.Type.GetType("MyStronglyTypedDataSet.MyTableRow"); // works
System.Web.Compilation.BuildManager.GetType("MyStronglyTypedDataSet.MyTableRow", true); // fails
Update 1 : Inner class notation is required:
System.Web.Compilation.BuildManager.GetType("MyStronglyTypedDataSet+MyTableRow", true); // fails
Update 2 : You still can’t use DataObjectTypeName
Turns out the MyStronglyTypedDataSet+MyTableRow doesn’t have a parameterless constructor.
Suddenly code generation without magic seems much more palatable.
About this entry
You’re currently reading “ Don’t Fight the .Net GridView ,” an entry on Chui's Counterpoint
- Published:
- 6.2.06 / 1pm
- Category:
- .Net
No comments
Jump to comment form | comments rss [?] | trackback uri [?]