Applying the desired FormatString would work if the value which the FormatString looks up is of type DateTime. However, when you place a DateTime value in a GridViewTextBoxColumn it is being converted to an ordinary string and FormatString has no effect on it. Therefore, if you need to format the value, it should be stored in a GridViewDataTimeColumn which will keep its DateTime type. Alternatively, if you for some reason need to use GridViewTextBoxColumn, you can manually format the shown text using the CellFormatting event:
sender, CellFormattingEventArgs e)
indexOfSpace = e.CellElement.Value.ToString().IndexOf(
e.CellElement.Text = e.CellElement.Value.ToString().Substring(0, indexOfSpace);
I hope this helps.
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>