Tuesday, January 29, 2013

ASP.NET Coding Thoughts


Sometimes you just have to bang your head until you get it.  I worked till 9:00 PM EST yesterday to figure out the Network App App.

It was very challenging and frustrating, but I did learn quite a few things.

Using TryCast() or DirectCast() methods don't work well if  you are not in the correct container that you are trying to cast, aka our famous formview container.

Hint Hint… the most of the user controls are all in the formview --- That got me.

I keep saying to myself, why the hell are you not picking up the usercontrol (Then it clicked)

 The past programmer did a great deed by hard coding values on properties when you pass the value to the properties…  No problem that was fixed for the  Show_Add() Property.   

Finally the call of the user control was overwriting the properties that I set because of the ASP.NET Page Load Cycle.  As a result the user control properties value sets are set in the Me.PreRenderComplete Event (GOTCHA)

So in all lessons learned.

My takeaways.

  1. Use DirectCast when you know the value type and in this scenario were casting the user control  with ID = ctrl_db_commands1 
  1. Find the control in the correct container, never trust old applications and always research where these controls exist
  1. If your properties are not changing you better debug and find out why in this case the values where hard coded in the properties, which was updated to work correctly.


Wow, what a challenge, what next does work have for me, from this point forward I will not take any of this code for granted.
Post a Comment