tag:blogger.com,1999:blog-289192482024-03-07T14:52:39.972+01:00Vault of ThoughtsMy random thoughts on programming and software development. ASP.NET, C#, Best Practices and other stuff.Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.comBlogger41125tag:blogger.com,1999:blog-28919248.post-1155207144905747842006-08-10T12:51:00.000+02:002006-08-10T12:52:24.916+02:00Visual Studio Code SnippetsI have posted an article about Visual Studio Code Snippets it is available here.Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com0tag:blogger.com,1999:blog-28919248.post-1155037909759109412006-08-08T13:49:00.000+02:002006-08-08T13:51:49.776+02:00ASP.NET Controls PackI have posted a new article containing a couple of controls I use on a daily basis. It can be found here.Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com0tag:blogger.com,1999:blog-28919248.post-1154945322936425312006-08-07T11:22:00.000+02:002006-08-07T12:08:42.953+02:00I have moved my blogI 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 :-).Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com3tag:blogger.com,1999:blog-28919248.post-1154524616787402882006-08-02T15:15:00.000+02:002006-08-02T15:55:26.696+02:00Visual Studio 2005, LINQ and Refactoring ProblemsI 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 Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com3tag:blogger.com,1999:blog-28919248.post-1154429453321841742006-08-01T12:24:00.000+02:002006-08-01T14:22:52.156+02:00Strongly Typed Templated ControlsAll 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.Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com0tag:blogger.com,1999:blog-28919248.post-1154349797439825232006-07-31T14:33:00.000+02:002006-07-31T14:53:56.040+02:00Javascript in the address barI have written few times about the little known features of variuos products etc. Today I will add one more to the list. There is a little known feature that web browsers have that can be very useful...The feature I'm talking about is the possibility to execute simple (or even complex) Javascript code from the address bar. While reading this go ahead and type something like:javascript: alert(2+2)Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com7tag:blogger.com,1999:blog-28919248.post-1153476441389290142006-07-21T12:07:00.000+02:002006-07-21T12:10:31.073+02:00Using Bind with nested propertiesASP.NET 2.0 comes with a mechanism called two way databinding which allows us to declaratively bind a form element to a property of an object in such way that updates are supported. For the readonly display you typically use the Eval method in your aspx page. For the two way mechanism, you use the Bind keyword (or method?).Using the Bind keyword is really simple in most scenarios that you Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com5tag:blogger.com,1999:blog-28919248.post-1153317458351234112006-07-19T14:41:00.000+02:002006-07-19T15:57:38.456+02:00Debugging with immediate windowSometimes you really need to debug some part of the application but you don't want to start it. For example you want to debug some lower layer of the application and the startup time takes too long. There is a quick solution for this problem. You can use the Immediate Window from Visual Studio to start a debug session. Just type a class name (with namespace) and a method name you want to call if Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com1tag:blogger.com,1999:blog-28919248.post-1153223666801676692006-07-18T13:51:00.000+02:002006-07-18T13:54:26.816+02:00The Best resource on threadingI'm not working with threads much since ASP.NET hides almost all of this complexity from me, but then I'm not working with ASP.NET exclusively. There are times when I need to do some multi-threading. In times like this I'm very happy that there are resources such as this available on the Internet. Currently It is the best article on threading I have seen. A good read.Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com0tag:blogger.com,1999:blog-28919248.post-1153143155587280292006-07-17T15:32:00.000+02:002006-07-17T15:35:29.406+02:00Creating object instance without calling its constructorFor a long time I have been in need of a mechanism that allows me to create an instance of an object without calling any of its constructors like the Activator.CreateInstance does. All this time I have also been aware of the fact that it can be done. My motives weren't strong enough to dig dipper in to the problem, though. Until recently...On my recent project I have enforced the use of a factoryMikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com5tag:blogger.com,1999:blog-28919248.post-1153129591591814812006-07-17T11:45:00.000+02:002006-07-17T15:35:48.343+02:00Master Page ContentPlaceHolder inside head elementToday I have been struggling with a typical table layed out page. It was a MasterPage with few ContentPlaceHolder controls - one for content, one for menu and few for other things. The problem was that the place holders were inside the td elements and some of the elements were made in such a way that they dropped shadow (background-image) and it was not possible from the content page to override Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com4tag:blogger.com,1999:blog-28919248.post-1152868170874052862006-07-14T10:43:00.000+02:002006-07-14T11:09:30.883+02:00FireFox memory consumptionWhile working on one of the web projects in asp.net that was targeted for FireFox browser only I have found an interesting thing. Take a look at the memory consumption of a FireFox process:Now, I wasn't doing anything unusual. Just testing how the site looks like in the browser. And I have only used 1 tab and only for this one application. Also the memory consumption got as high as 300mb in few Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com0tag:blogger.com,1999:blog-28919248.post-1152786802281931052006-07-13T11:47:00.000+02:002006-07-13T12:33:22.296+02:00GetHashCode of the string classBeing a curious person I have wondered how the GetHashCode method of the string class is implemented so I have performed some research. The results are interesting at least.First thing I have checked is if the GetHashCode method for the same string say "xxx" on two separate machines returns the same value - and in fact it does. This has led me to use the Reflector to see the internals of the Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com3tag:blogger.com,1999:blog-28919248.post-1152636915091939632006-07-11T18:44:00.000+02:002006-07-11T18:55:15.100+02:00A custom container controlI have made some research on how to create a container control - a control which works in a similar way as the Panel control does. There are three key thing you have to do in order to make it work:Add ParseChildren(false) attributeAdd PersistChildren(true) attributeAdd Designer(typeof(PanelDesigner)) attribute where PanelDesigner is a custom class deriving from ContainerControlDesigner. I haven'tMikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com1tag:blogger.com,1999:blog-28919248.post-1152275915745636742006-07-07T14:32:00.000+02:002006-07-07T14:39:59.846+02:00Visual Studio mystery lineFrom time to time a strange thing happens to my Visual Studio - a strange line appears on the screen in a random place and stays there until VS is restarted. It is only visible in VS, when switching to other programs it disappears. Switching between windows inside visual studio does not help.This is just one of the hidden and secret features of the VS that most people don't know about. The other Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com0tag:blogger.com,1999:blog-28919248.post-1152216198549214662006-07-06T21:30:00.000+02:002006-07-06T22:08:41.690+02:00PathsBuildProvider updateI have used my PathsBuildProvider a while now and I have came across some issues. I have found two major issues.The first issue had to do with the fact that from some strange reasonthe development web server treats root directory "/" in a differentway than IIS. So redirecting to /aplicationname/page.aspx hasdifferent effect those two servers. I have made a change so that theproperty is not Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com0tag:blogger.com,1999:blog-28919248.post-1152114804295049812006-07-05T17:47:00.000+02:002006-07-05T17:53:24.303+02:00GetWebResourceUrl method catchAfter a lot of time spent on working with the Page.ClientScript.GetWebResourceUrl method made it work and it was good. I had my ImageCheckBox control which worked well using this method. The problem occured when I have inherited from the control in another project. It stopped to properly reference the javascript from the resource url. After short investigation I have found the that the problem Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com0tag:blogger.com,1999:blog-28919248.post-1152041139611880232006-07-04T21:09:00.000+02:002006-07-04T21:32:47.266+02:00Optimizing rendered page sizeI do not often rename the controls that I do not use in the code behind code, so when I place a Label on a page it most often is named something like Label1. It does not make a big difference when you are not paying for the bandwidth and you only have a few controls on a form. Imagine however that you are working with Master Page and there you are using the defaul ContentPlaceHolder1 as a place Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com1tag:blogger.com,1999:blog-28919248.post-1151441349341097022006-06-27T22:39:00.000+02:002006-06-27T22:49:09.350+02:00UrlProperty and skinsWhile working with my validator controls that support displaying images, I have come to a situation where I needed the image to be themable. Easy you think?Not so easy as it should be. I have added the Themeable(true) attribute to an ImageUrl property, put a control on a page set everything in the skin file, compilled and... ??? No it didn't work. Url points to the same directory as specified in Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com0tag:blogger.com,1999:blog-28919248.post-1150893565424860382006-06-21T14:35:00.000+02:002006-06-21T14:39:25.436+02:000.(9) == 1Yesterday I have found the post about the 0.(9) (zero, and infinite number of nines) equals 1. All of you weak at heart don't read it :-).Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com0tag:blogger.com,1999:blog-28919248.post-1150835506411469512006-06-20T22:23:00.000+02:002006-06-20T22:55:15.036+02:00Validation controls as images - workaroundI have been trying to make the Validation controls show an image instead of plain text in case of an error. In doing so I have used Reflector a lot.My investigation had lead me to some conclusions and even more questions. The main problem here is that for some creepy reason, the BaseValidator inherits directly from a Label control!!! Now I have always been aware of this fact but it was until not Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com0tag:blogger.com,1999:blog-28919248.post-1150834976432262492006-06-20T22:16:00.000+02:002006-06-20T22:22:56.433+02:00RuntimeObjectEditorFew days ago I have found some tool which I can honestly say is almost as good as the famous Reflector.The tool is called RuntimeObjectEditor and does just that: it allows you to edit your applications at runtime. Amazing! You have to check it out!Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com0tag:blogger.com,1999:blog-28919248.post-1150147366268579642006-06-12T23:11:00.000+02:002006-06-12T23:58:04.660+02:00ClassPropertiesBuildProviderSome time ago I have posted an article about using Build Provider feature of ASP.NET 2.0 to build a strongly typed classes for accessing the files found in the application virtual directory. I myself have been using this provider ever since for every Response.Redirect(). I hope that it serves you as well.I have found yet two more ways of using the Build Providers to make your applications safer (Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com8tag:blogger.com,1999:blog-28919248.post-1149619786169070892006-06-06T20:37:00.000+02:002006-06-06T20:57:08.943+02:00When it isn't safe to use the Parent property of a controlWhile working on MyDataSourceControl (see my other articles) I have found an interesting thing. It appears that when properties of a control are set to the values provided as attributes in the aspx file, the control is not yet very functional. The most important thing that my be not set is the Parent and other control-tree related properties of the control! It seams however that it is not always Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com0tag:blogger.com,1999:blog-28919248.post-1149617099470281822006-06-06T19:55:00.000+02:002006-06-06T20:04:59.686+02:00Minor update to MyObjectDataSourceToday I have discovered an error in MyObjectDataSource that caused NullReferenceException to sometimes appear when the TypeName was not provided. I was unable to tell what was causing the problem because on some pages the control worked fine and on the others it didn’t. Sources are available as usually here and here.Mikeonhttp://www.blogger.com/profile/04578119336523867504noreply@blogger.com0