how do I store the MaskedEdit "/" to my database field?

hi
I'm using <ajaxToolkit:MaskedEditExtender
I need to store my date this format 99/99/9999
I need to store the slash "/" with me
I need to start entering the date from right to left
As long I'm using Arabic hijiri date my date should be store to the database in a nvarchar (10) this way 30/12/1435
Please help
Mohammad Alsolaimanapplication programmerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sinisa VukCommented:
Replace all single '/' with double '//' slash before storage. Date value can be stored in database in international english format - because this is just simple value. You need to store display format instead - this one can tell what and how is this value displayed to user.
0
Mohammad Alsolaimanapplication programmerAuthor Commented:
I'm newbie to c# , would you write me sample code please .
0
Mohammad Alsolaimanapplication programmerAuthor Commented:
Sinisa Vuk
i try what you've wrote bu nuthing happen.
i did it in c# this way
txtReportDate.Text.Substring(4,4) + "/" + txtReportDate.Text.Substring(2,2) + "/" + txtReportDate.Text.Substring(0,2);

Open in new window

it works good
any comment please
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Sinisa VukCommented:
This is for date storing, and not mask? ... as you wrote that you need to store a mask.
Think that date should be stored in format: yyyy-MM-dd (into database)

txtReportDate.ToString("yyyy-MM-dd");

Open in new window

0
Sinisa VukCommented:
0
Mohammad Alsolaimanapplication programmerAuthor Commented:
Thank you for the advice
I'm using Arabic hijiri date. And each country has it's own calendar calculation.
So, the best practice to solve this issue is mapping table, contains each Gregorian date and the equivalent Hijiri date. Then do your date calculations in Gregorian, and return with the equivalent Hijiri date.
That was the reason I store the Hijiri date in nvarchar
so I'm storing my Hijiri date as a text 1435/09/19.
0
Sinisa VukCommented:
If you store as text - then always stick to one format - and you should not get a problem
0
Mohammad Alsolaimanapplication programmerAuthor Commented:
Yes, my question was is it possible to do these slashes in MaskedEdit? Instead of doing it in c#.
0
Sinisa VukCommented:
probably you need to set MaskType, CultureName, Format properties:

MaskType="Date"
CultureName="something"
Mask="99/99/9999"
Format="MM/dd/yyyy"

Culture can be set to fixed like "en-GB" or invariant:
....
system.threading.thread.currentthread.currentculture =    
  system.globalization.cultureinfo.invariantculture

Open in new window


example: http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/MaskedEdit/MaskedEdit.aspx
0
Mohammad Alsolaimanapplication programmerAuthor Commented:
i try experts suggestions but it was not what I need
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.