All,
How to create a mask to the DateTime field in the propertygrid such a way that, user can enter only in that format. For example, by default "dd/mm/yyyy" should be displayed in the DateTime field. When user key in numbers, the numbers should replace the respective palces. Ofcourse, user can give input from DateTime picker also.
Please, suggest me by giving code snippets or sample source code. Thanks in advance.

Scott LysleRank #49 · 31K reputationPosted Feb 7, 2009, 7:55 PM EST
Scott LysleRank #49 · 31K reputationPosted Feb 7, 2009, 7:55 PM EST
kumar p14 reputationPosted Feb 8, 2009, 1:27 AM EST
First of all, Thanks for the response.......
Actually, Im using C# and .NET......I tried as you said. But, I did not get expected result.
Please, If you have a source code, share with me. Thank you.......
kumar p14 reputationPosted Feb 8, 2009, 10:03 PM EST
all,
Can we customize the propertygrid such a way that it can fit in my needs???
Bijayani Baijayanti14 reputationPosted Jun 23, 2010, 1:09 AM EDT
Provided below are code samples written in C# to format an input as per SharePoint DateTime field.
/* -- Format for Date Only Field -- */
private static String ToSPDate(String strDt)
{
if (strDt == String.Empty)
return strDt;
else
return (Convert.ToDateTime(strDt)).ToString("yyyy-MM-dd");
}
/* -- Format for DateTime Field -- */
private static String ToSPDateTime(String strDt)
{
if (strDt == String.Empty)
return strDt;
else
return (Convert.ToDateTime(strDt)).ToString("yyyy-MM-ddTHH:mm:ssZ");
}
Thanks,
Bijayani
SharePoint Development