none
SPGridView

    Question

  • Hello,

    I am using SPGridView in SP2010. I am attaching a datatable to this SPGridView which has a date column in it. But, I dont want to show the timestamp which is comming alongwith the date.

    There is no dataFormatString property supported for the SPGridView. How do I achieve the same..? This has to be done with SPGridView only.

    Thanks in advance..


    alex
    Tuesday, October 26, 2010 5:30 AM

Answers

  • Hi Sandip,

    Thanks for ur valuable reply.

    I found a very simple work around for this.

    Solution : For the SPGridView, I added a BoundField and NOT SPBoundField. Then, I configured it using

    boundfieldStartDate.DataFormatString =

     

    "{0:MM-dd-yyyy}"; property.

    Amazingly,.Net allowed me to do

    SPgridviewTasks.Columns.Add(boundfieldStartDate); Note that boundfieldStartDate is not SPBoundField.

    It displayed the result as I was expecting. This is much more simpler. Just requires a single line of code.


    alex
    • Marked as answer by Alex Cardo Wednesday, October 27, 2010 5:41 AM
    Wednesday, October 27, 2010 5:41 AM

All replies