Problems Creating Custom DataSource Enabled Controls in ASP.NET 2.0


Url: http://lab.msdn.microsoft.com/productfeedback/v...

I find it unfortunatle that Microsoft has made is way too difficult to write your own DataSource enabled controls.  Deriving from DataBoundControl, but it still does not seem to be a way to synchronously get the data from the DataSource.  In a DataBoundControl control you can get the DataSourceView like so:

DataSourceView view = this.GetData();

Great!  Except that to actually get the code from the view requires you call view.Select() which is asynchronous.  Luckily for Microsoft, their controls use a friend/internal method called ExecuteSelect().  If you look into the code that the GridView, FormView and DetailsView use, they don't call it asynchronously, but you have to ;)

There was a LadyBug filed...but was marked as "We're not taking new suggestions for Whidbey any more". 

That leaves the control designer with two options, call it asynchronously or use reflection hackery to call ExecuteSelect.  ARG!



Shawn
Shawn Wildermuth
Author, Teacher, and Coach




My Courses

Wilder Minds Training
Vue.js by Example (New Lower Price)
Bootstrap 4 by Example (New Lower Price)
Intro to Font Awesome 5 (Free Course)
Pluralsight
Building an API with ASP.NET Core (New Course)
Building a Web App with ASP.NET Core, MVC6, EF Core, Bootstrap and Angular (updated for 2.2)
Less: Getting Started (New)
Using Visual Studio Code for ASP.NET Core Projects
Implementing ASP.NET Web API

Application Name WilderBlog Environment Name Production
Application Ver v4.0.30319 Runtime Framework x86
App Path D:\home\site\wwwroot\ Runtime Version .NET Core 4.6.27817.01
Operating System Microsoft Windows 10.0.14393 Runtime Arch X86