When hosting a website in IIS you may get the error below when trying to view the page in IE.
unrecognized configuration section 'connectionstrings'
One of the reasons for this maybe because in IIS, the website is configured as a .Net 1.1 application rather than .Net 2.0, to fix this, right click on the website application in IIS and choose properties and click on the ASP.Net tab and choose the ASP.Net version to be 2.0!
Showing posts with label .Net 2.0 Tips. Show all posts
Showing posts with label .Net 2.0 Tips. Show all posts
Monday, 6 July 2009
Thursday, 7 August 2008
Validating Currency fields regular expression
Expression: ^\d{0,2}($|\.\d{0,2}$)
Example of valid values:
20.09
1.99
1.2
3
.5
Example of invalid values:
120.09
1.991
x
Example of valid values:
20.09
1.99
1.2
3
.5
Example of invalid values:
120.09
1.991
x
Monday, 19 November 2007
Visual Studio shows Dots for spaces
Ctrl-R followed by Ctrl-W will enable/disable the feature in Visual studio which will show dots for spaces, very annoying.
Thanks thekua for the solution http://www.thekua.com/atwork/2007/03/21/visual-studio-2005-annoyances/
Thanks thekua for the solution http://www.thekua.com/atwork/2007/03/21/visual-studio-2005-annoyances/
Tuesday, 14 August 2007
Quick Tips C#
This post will contain a list of quick tips and good practices in c# that I use..I will be updating this list as I find new things...If you have anything that you would like to contribute, please post them in the comments...cheers
1. Use string.IsNullOrEmpty() - short and sweet to check whether a string is null or empty
2. goto keyword, this is a very useful keyword that can be used to skip certain lines of code in a method - http://msdn2.microsoft.com/en-us/library/13940fs2(VS.71).aspx
1. Use string.IsNullOrEmpty() - short and sweet to check whether a string is null or empty
2. goto keyword, this is a very useful keyword that can be used to skip certain lines of code in a method - http://msdn2.microsoft.com/en-us/library/13940fs2(VS.71).aspx
Monday, 13 August 2007
Highlighting Row in GridView
I recently had a situation where I had to highlight a row in the gridview if the value of the column Today was 0. Found out there was a very easy way to do it using the OnRowDataBound Event of the GridView, the code's below..
protected void GridViewID_OnRowDataBound(object sender, GridViewRowEventArgs e)
{
GridViewRow row = e.Row;
if (row.RowType == DataControlRowType.DataRow)
{
DataRowView drv = row.DataItem as DataRowView;
string fieldName= drv["FIELDNAME"].ToString();
if (fieldName.Equals("0"))
row.CssClass = "YourCssClassName";
}
}
protected void GridViewID_OnRowDataBound(object sender, GridViewRowEventArgs e)
{
GridViewRow row = e.Row;
if (row.RowType == DataControlRowType.DataRow)
{
DataRowView drv = row.DataItem as DataRowView;
string fieldName= drv["FIELDNAME"].ToString();
if (fieldName.Equals("0"))
row.CssClass = "YourCssClassName";
}
}
Subscribe to:
Posts (Atom)