StrataFrame Forum

1/1/1800 default value

http://forum.strataframe.net/Topic7548.aspx

By Keith Chisarik - 3/16/2007

I know this is the default value show for a date field, I was OK with that since my customer told me that upon initial data entry all date fields would have "real" values put into them. This turned out to not be the case so I have a website displaying a bunch of 1800 dates to end users Sad



My question is this, is there any quick and dirty way you can think of to either not show the date in the textbox if it is 1/1/1800? Heck I dont even care of the textbox itself doesnt show. I would like to accomplish this with only code changes and not changes to the database and BO's.



Help as always appreciated.







Keith


By Trent L. Taylor - 3/16/2007

You could accomplish this several ways.  First, since this is a web page, you could hide the text boxes on the page Load event if the dates are 1/1/1800.

MyText.Visible = MyBO.MyDate.Year <> 1800

If you have any 3rd party web controls such as Infragistics that have a web based date time control, you can also set the "NULL" value to be 1/1/1800 which would show an empty field.

Last, you could create your own text box which and implement your own data binding and NULL value support.  The NULL value in this case would be 1/1/1800 which you could then return an empty string when displaying the control.

By Keith Chisarik - 3/19/2007

that worked great thanks, so simple I feel silly for asking now.



I dont think this one is as easy...



I need to improve the visual formatting of a SF listview on a webpage.



I would like to center specific columns only, make some columns and the header text bold, and then shade the background of the header a different color. Can you point me in the right direction? I see 'headercssclass' but that was all i found and I don't know how to use it.



Thank you.



By Trent L. Taylor - 3/19/2007

You can do this actually pretty easily.  Remember that the ListView is doing nothing more than creating an HTML table when it is all said and done.  You also have the same flexibility as the WinForms by using a population through an event rather than by the formated element.  When you populate through the RowPopulating event, you can test on your BO and add any HTML tags that you require.

A style sheet just makes these types of things easier so you can go back and make a single change rather than having to dig back into your code.  To see this in action, open up the Web Sample Application that comes with StrataFrame.  Go to the SearchCustomers.aspx page and there is a ListView on that page that uses the HeaderCssClass tag, CssClass tag, and populates one of the columns through the RowPopulating event.  I think that this will get you going in the right direction.

By Keith Chisarik - 3/19/2007

awesome thanks!