Vault of Thoughts

2006-08-10

Please visit my new blog at vaultofthoughts.net

Visual Studio Code Snippets

I have posted an article about Visual Studio Code Snippets it is available here.

2006-08-08

Please visit my new blog at vaultofthoughts.net

ASP.NET Controls Pack

I have posted a new article containing a couple of controls I use on a daily basis. It can be found here.

2006-08-07

Please visit my new blog at vaultofthoughts.net

I have moved my blog

I have moved my blog to a new address. Expect all new posts to appear there. I will keep posting here also for some time, until I get properly indexed in google :-).

2006-08-02

Please visit my new blog at vaultofthoughts.net

Visual Studio 2005, LINQ and Refactoring Problems

I haven't played with it a lot but but the most obvious was the far from complete support from the IDE. Given it is not a complete product I'm not blaming MS for it. What I blame MS for is the fact that installing LINQ is a destructive process i.e.: it damages some of the existing features of VS 2005.


For me the One thing that hurt the most was the fact that the refactoring SmartTags stopped working from a keyboard shortcut and that the Refactor option was missing from the context menu of the code window.


Since I could not imagine working without some useful shortcuts I started the process to recover the lost features. I've tried to reset the shortcuts from Tools-Options-General-Keyboard menu but it had no effect. Next I have tried to reset all settings using Tools-Import and Export Settings - no effect. Next there came Google.


I have found and that someone had a similar problem and there was a solution. Few posts from the top there is a 4 steps instruction (which didn't work for me) and than a 5th step which finally worked. I'm putting the stepps I have followed in for your convenience:



  1. Start up RegEdit.exe

  2. Open HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\8.0\Packages\{A066E284-DCAB-11D2-B551-00C04F68D4DB}\SatelliteDLL

  3. Edit the "Path" value and change it from "C:\Program Files\Microsoft Visual Studio 8\VC#\VCSPackages\1033\" to "C:\Program Files\Microsoft Visual Studio 8\VC#\VCSPackages\"

  4. Restart Visual Studio and see if these problems are fixed?

  5. Go to C:\Program Files\Microsoft Visual Studio 8\Common7\IDE and run devenv /setup followed by devenv /resetuserdata followed by devenv /resetsettings CSharp.


All this stuff makes me wonder. I have been using beta software since I have learned using computers but I cannot remember having this kind of problems. Maybe the betas I use are not as complicated as Microsoft products but hey! They are not developed by the army of developers!


kick it on DotNetKicks.com

2006-08-01

Please visit my new blog at vaultofthoughts.net

Strongly Typed Templated Controls

All of us who have been using any kind of ASP.NET Templated Controls such as FormView, sooner or later come to a problem of extracting value from a field inside a template. For example when you are using a FormView control and want to programatically access a control inside one of the templates. What are the options? You have to resort to some kind of FindControl calls which are way from perfect. I have been thinking about this issue for some time now and I have an idea.


The idea is to change tha way the PageBuildProvider constructs the part of class that represents the ASPX file of your page. (the other one is of course the code behind). So what could be changed? Imagine a situation where you have a page and there is just one FormView on it. The FormView has its templates defined in an ASPX file. What happens now is the ASP.NET framework builds the part of the class given this ASPX file and what we get is a nice intellisense in the code behind telling us that the our class has a field FormView1 of type FormView which of course does not have any knowledge about controls inside the templates. But what if...


But what if instead of the FormView1 being of type FormView, the part of the class constructed from ASPX file provided us with a field FormView1 of type derived from the FormView but with few additional properties which represent controls found inside the templates - in a strongly typed manner.


Now. The benefits of such a solution are obvious mainly compile time type checking.


Is it possible to make ASP.NET 2.0 to provide such a solution? This is a hard question. I have checked the major components that are responsible for the way the classes are constructed now. I haven't gone deep into details but it it looks like some changes inside the PageBuildProvider (or some base classes) would be required. Also a ControlBuilder responsible for building a templated control would have to constuct a whole new class representing our control. I suppose that the major problem lies in constructing such a derived class with all those properties representing inner controls.


So basically I hope MS will/is thinking about making our lives easier and more type safe :-) or maybe some brave developer is willing to try to implement my concept? Either way it would be nice to have such a feature some time in the future.


Some additional considerations include the problem with accessing controls from ItemTemplate of a FormView control when in Edit mode. Another issou would be with controls such as GridView where some of the templates represent a repeating content and not a single data etc...


kick it on DotNetKicks.com