If you've ever had to register client side script from the server-side, you know that in .NET 4.0, the way to do it on a normal ASPX page is to use the ClientScript.RegisterStartupScript syntax like below:
Normal ASPX Page
string Message = "Hello World!"; ClientScript.RegisterStartupScript(this.GetType(), "alert", string.Format("alert('{0}');", Message), true);
and if you need to register from within an update panel, you'll need to use a ScriptManager like the code below:
Within Update Panel
string Message = "Hello World!"; ScriptManager.RegisterStartupScript(this.GetType(), "alert", string.Format("alert('{0}');", Message), true);
However, I ran into a problem today where my above code didn't work because my UpdatePanel was within a Web User Control! What I figured out is that for the type parameter, you need the current PAGE type, not the user control type, so your code should look like this:
Within Update Panel Within A Web User Control
string Message = "Hello World!"; ScriptManager.RegisterStartupScript(this.Page.GetType(), "alert", string.Format("alert('{0}');", Message), true);
Ah the joys of updatePanels and Web User Controls. I hope this helps someone!
Wednesday, October 19, 2011
Friday, October 14, 2011
SVN Structure
Here's a great article on how to set up a trunk/branch/tag structure for svn.
http://ariejan.net/2006/11/24/svn-how-to-structure-your-repository
This is especially helpful when you need to do parallel development, or if you're in a state where you are developing new code while bug-fixing existing code, while still having to do releases.
http://ariejan.net/2006/11/24/svn-how-to-structure-your-repository
This is especially helpful when you need to do parallel development, or if you're in a state where you are developing new code while bug-fixing existing code, while still having to do releases.
Thursday, October 6, 2011
How to Change Your Default Browser in Visual Studio
Here are the steps to change your default browser in VS2010. I had to do this today so...
1) Open a WebForm file in VS (anything ending in .aspx will do)
2) Select the "Browse With..." option from the File menu
3) Select your preferred browser from the list and click the "Set as Default" button
Voila!!
1) Open a WebForm file in VS (anything ending in .aspx will do)
2) Select the "Browse With..." option from the File menu
3) Select your preferred browser from the list and click the "Set as Default" button
Voila!!
SQL Source Control
I'm sure there are others out there that have had this problem with their database. Here's the scenario:
With your code you have a nice code repository set up. You are able to check in code, get latest, merge code, keep a nice version history with comments, etc. but when it comes to the database, all of that is a little harder to manage. Maybe you keep your scripts in SVN, but then you have to modify them in SVN before you update the server, make sure it compiles, commit the script in SVN, etc. but it's not all in one neat little IDE as it is with your code. It takes a few more steps to get all of the benefits of having a code repository when it comes to dealing with the database.
In comes Red-Gate's SQL Source Control. We just downloaded the trial and started using it. Setup literally took five minutes, and now we're able to use source control directly in SQL Management Studio!! It's quite brilliant if you ask me.
Check out the link below and watch the funny animated video if you'd like a quick overview of how it all works.
http://www.red-gate.com/products/sql-development/sql-source-control/
*Here's a direct link to the promo video, which I thought was quite clever:
http://www.red-gate.com/products/sql-development/sql-source-control/assets/video/SQL-Source-Control-Animation2/SQL-Source-Control-Animation.swf
With your code you have a nice code repository set up. You are able to check in code, get latest, merge code, keep a nice version history with comments, etc. but when it comes to the database, all of that is a little harder to manage. Maybe you keep your scripts in SVN, but then you have to modify them in SVN before you update the server, make sure it compiles, commit the script in SVN, etc. but it's not all in one neat little IDE as it is with your code. It takes a few more steps to get all of the benefits of having a code repository when it comes to dealing with the database.
In comes Red-Gate's SQL Source Control. We just downloaded the trial and started using it. Setup literally took five minutes, and now we're able to use source control directly in SQL Management Studio!! It's quite brilliant if you ask me.
Check out the link below and watch the funny animated video if you'd like a quick overview of how it all works.
http://www.red-gate.com/products/sql-development/sql-source-control/
*Here's a direct link to the promo video, which I thought was quite clever:
http://www.red-gate.com/products/sql-development/sql-source-control/assets/video/SQL-Source-Control-Animation2/SQL-Source-Control-Animation.swf
Wednesday, October 5, 2011
Creating a DB project based off of SQL Server
If you ever need to create a database project based off of an existing database, here's a link that shows you how to do it very quickly and easily with VS 2010.
Link
You may want to do this if you want to save your schema and things like that in source control.
Another neat advantage to creating a database project is that you can actually compile it and it will show you any errors you may have buried deep in your database. We did this recently on one of our databases and realized that we had a few Views that were no longer being used, and that referenced column names that no longer existed. Without using a DB project and trying to compile, those views probably would have sat on that database untouched for the rest of time.
Link
You may want to do this if you want to save your schema and things like that in source control.
Another neat advantage to creating a database project is that you can actually compile it and it will show you any errors you may have buried deep in your database. We did this recently on one of our databases and realized that we had a few Views that were no longer being used, and that referenced column names that no longer existed. Without using a DB project and trying to compile, those views probably would have sat on that database untouched for the rest of time.
Monday, October 3, 2011
SVN Setup
I'm setting up a brand new dev environment, and we use SVN here. I found myself referencing this blog from a friend of mine, Greg Galipeau which highlights while file types he likes to exclude from SVN settings. Check it out:
http://www.greggalipeau.com/?s=svn&x=0&y=0
http://www.greggalipeau.com/?s=svn&x=0&y=0
Subscribe to:
Posts (Atom)