Sorry if my question seems to simple .
Right now in the BoundField of my GridView some data display like "12/11/1381" that i wanna display like "1381/11/12" (opposite direction) .
I know i could change the direction via rtl and ltr in TemplateField. But because of some reason i can't convert my boundfield to templatefield.
I looked through all BoundField properties in order to change direction , but i found nothing.
I think that should be done in RowDataBound event of GridView , But i don't know how !?
What do you think at this case ?
Thanks in advance.
Best Answer
Ok, since it's a date which was input as string, there are at least 2 ways you can do it.
Method 1
Databind the string as a
Date
object instead ofString
. As I do not now the exact date format of the original date, dd/MM/yyyy or MM/dd/yyyy, you'll have to figure it out yourself.If you can do that, just add this to the "BoundField" element:
or
Method 2
Manipulate the text in ROwDataBound oevent. I've done a crude one here which can be polished up. You should probably manipulate them as
Date
objects.In the ASPX:
CodeBehind: