Wednesday, December 10, 2008

string.format new line partially works (C#, ASP.NET)

see below my code. every "\n" works fine except the ones after "Event: {0}" and "Start Date: {1:D}", basically the Event, Start Date and End Date are printed on same line. can anyone help please? thanks in advance.

string.Format(



"Schedule Details: \n" +

"Event: {0}\n"+


"Start Date: {1:D} \n" +

"End Date: {2:D} \n" +

"Location: {3} \n"


,schedule.event,
schedule.startDate,
schedule.endDate,
schedule.location);

I tried ""Event: {0}"+ Environment.NewLine" and "Event: {0}\r" and "Event: {0}/r/n" got the same result
==============

Schedule Details:

Event: Basketball Match Start Date: Friday, 1 May 2009 End Date: Tuesday, 30 June 2009

Location: Como
================

Then I tried "Event: {0}\n"+ Environment.NewLine" and "Event: {0}\r"+ Environment.NewLine" and "Event: {0}/n/r" got this result (an additional line)
==============


Schedule Details:

Event: Basketball Match

Start Date: Friday, 1 May 2009 End Date: Tuesday, 30 June 2009

Location: Como
================

It seems that it works either for no newline or 2 new lines, but not for 1 newline. I tried to take out "Event" everything else worked just fine, so the problem must be with "Event"?

The Event has datatype of "string", startDate and endDate are datetime, location is string. A sample of Event value is "Attend Class Certificate III in Basketball".

Eventually the problem is solved, not sure why though.....:

I put single quotes around the Event value, not sure how exactly but it worked.
"Event: '{0}'\n"+

Tuesday, August 05, 2008

select checkboxlist based on to database data

foreach(datarow in the query result)
{

ListItem currentCheckBox = CheckBoxListABC.Items.FindByValue(datarow ["TheFieldName"].ToString());
if (currentCheckBox != null)
{
currentCheckBox.Selected = true;
}
}

Monday, August 04, 2008

ASP.NET C# capitalize the first letter of a string

using System.Globalization;
..
..
..
..
..
string ManipulatedString= CultureInfo.CurrentCulture.TextInfo.ToTitleCase("OriginalString");

Saturday, August 02, 2008

"postback" event not related to REVIOUS and NEXT button on Internet Explorer?

in my case PageA has a buttonA that opens PageB. The code is "response.redirect("PageB.aspx");"

on PageB I have some methodM to call under condition "if (!IsPostBack)"

After I clicked on ButtoA to open PageB, methodM is trigerred.

but when I use the PREVIOUS button on Internet Explore to go back to PageA and click on NEXT button to go back to PageB the methodM didn't fire.

How can I catch the Previous and Next button click event?

the answer is adding the code below into Page_Load in the target page, this line of code will force the target page to load from server instead of cache

Response.Cache.SetCacheability(HttpCacheability.NoCache);

Wednesday, July 30, 2008

a helpful tutorial for Creating a Data Access Layer in VS2005 Express

http://www.asp.net/learn/data-access/tutorial-01-cs.aspx

How to retrieve visitor's IP in C# ASP.NET 2.0

string strHostName = System.Net.Dns.GetHostName();
string clientIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();
return clientIPAddress;

Friday, July 25, 2008

MSSQL LIKE operator work with parameter values

without parameter: LIKE '%abc%'
with parameter: LIKE '%'+@searchString+'%'

Tuesday, June 17, 2008

useful stuff to solve visual studio 2008 slowness

found these links quite useful:
http://blogs.msdn.com/webdevtools/archive/2008/02/09/downloadable-hotfix-performance-and-editor-fixes-for-microsoft-visual-studio-2008-and-visual-web-developer-express-2008.aspx

https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=10826

Tomorrow's CIO: Are You Ready Today?

found this tool on InformationWeek very interesting:
http://www.informationweek.com/news/management/interviews/showArticle.jhtml?articleID=208403497#sg_wrapper

Monday, June 09, 2008

Cannot open .zip file in WSS 3.0

found solution for this problem on Microsoft
http://support.microsoft.com/kb/841120

Thursday, June 05, 2008

WSS 3.0 Search Service on SBS

You need to install and start Windows Indexing service, start SharePoint Search Service, and Change the Identity of the SP website in IIS-->Application Pools-->Properties from Network User to Local System User

Monday, May 26, 2008

project management - agile

project management - agile
In order to be agile everyone in the team must be proficient.

Thursday, May 22, 2008

ASP.NET DataBinding Eval V.S. Bind

Eval is used for one way data presentation whereas Bind is used to push data back to the database. Some detailed explanation:

http://www.15seconds.com/issue/040630.htm

Wednesday, May 14, 2008

Agile Project Management with Scrum

found this about Scrum, very helpful

http://agilescrum.tar.hu/agile_scrum_0035.html

Monday, May 12, 2008

"check-in pending" problem opening enterprise project within MS Project 2007

work around:
1. delete cache OR
2. when close the project, don't just click on "x", instead go File - Close

Friday, May 09, 2008

Available fields in Microsoft Office Project 2007

Available fields in Microsoft Office Project 2007
http://office.microsoft.com/en-us/project/HA102369301033.aspx?pid=CH100788901033

Thursday, May 08, 2008

what is Queue in MSPS 2007

Microsoft Office Project Server 2007 Queuing System

http://technet.microsoft.com/en-us/library/cc197395.aspx

Wednesday, May 07, 2008

what is resource units in Microsoft Office Project 2007

Sometimes it takes one resource to complete a task, but other times you need more. Sometimes a resource can only work part time. To account for these differences, Microsoft Office Project 2007 uses units (units: The quantity of a resource assigned to a task. The maximum units is the maximum number of units available for the resource. For example, if you have three plumbers, the maximum units is 300 percent or three plumbers working full-time.) to calculate the exact amount of time resources can work on a task............
Details: http://office.microsoft.com/en-us/project/HA102548291033.aspx

Configuring Linked Servers SQL Server 7 and 2000

found this post very helpful
http://www.informit.com/articles/article.aspx?p=21644

Tuesday, May 06, 2008

Endnote x1 with WORD 2007 slows down Windows Vista x64

found a workaround for this issue
http://www.endnote.com/envista.asp