Technical support This forum is closed.
Version 1.x > Technical support > SearchResults - How to format the date View modes: 
User avatar
Guest
marco - 2/12/2006 9:37:54 PM
   
SearchResults - How to format the date
Hi,

I'm using the CMSSearchDialog and the CMSSearchResults controls with help from the example of the developers guide. All my labels and results are now in the correct format via the cs file and adjusting the properties. I would to present the result of the date in another format. What is the best to do this and how?

Regards,

Marco

User avatar
Member
Member
mbuckley - 2/14/2006 5:34:20 AM
   
Re: SearchResults - How to format the date
I'm not overly familiar with this particular control, but you should be able to do a toString(format) on your date binding.

For example, if you would like to have something like "January 01, 2003" you would do

.ToString("MMMM dd, yyyy")

If you are using just a regular databinder, try something like this:
System.Convert.ToDateTime(DataBinder.Eval(Container, "DataItem.DateColumnNameHere")).ToString("MMMM dd, yyyy")


Hope that helps,

Mike

User avatar
Guest
admin - 2/14/2006 9:52:08 AM
   
Re: SearchResults - How to format the date
Hi Marco,

unfortunately, the CMSSearchResults controls doesn't support custom date/time formats.

If this is important for you, you may want to use the TreeProvider.Search method to receive a DataSet with search results and display them using standard ASP.NET Repeater control with datetime formatting functions such as

System.Convert.ToDateTime(DataBinder.Eval(Container, "DataItem.DateColumnNameHere")).ToString("MMMM dd, yyyy")

(as suggested by Mike).

Please let me know if I can be of any further assistance.

Best Regards,

User avatar
Guest
marco - 2/14/2006 7:17:14 PM
   
Re: SearchResults - How to format the date
I will try this and post my results

User avatar
Guest
marco - 2/14/2006 7:20:17 PM
   
Re: SearchResults - How to format the date
for now thnx for your info.....

User avatar
Guest
marco - 2/25/2006 11:14:21 AM
   
Re: SearchResults - How to format the date
Hi,

I'm using Tree.Search in combination with a dataset now. This works fine.
After that i'm using a DataView on _ds.Tables[0] to sort the date descending and eventually the Convert.ToDateTime with a string formatter which is set in the web.configto correctly format the date.

The results are not paged. Is there someone that has used paging for the resultset like Google? Or is there another option in Kentico for this?

User avatar
Guest
admin - 2/27/2006 10:32:21 AM
   
Re: SearchResults - How to format the date
Hello,

you may try using DataGrid (without header) to display the search results with paging.

Best Regards,

User avatar
Member
Member
sciamannikoo - 3/1/2006 9:05:00 AM
   
Re: SearchResults - How to format the date
The trick is in System.Web.UI.WebControls.PagedDataSource()

I suggest to read this article:
http://aspnet.4guysfromrolla.com/articles/081804-1.aspx

You can paginate anything :-)

You can search in google "paged datasource" to found other sources.

User avatar
Guest
admin - 3/2/2006 1:52:59 PM
   
Re: SearchResults - How to format the date
Thank you, Andrea. We will add a sample solution to the Knowledge Base in the nearest update.

Best Regards,