I have several pages that contains a Report in each one, and I used a base class for these pages called ReportBasePage.
The Report shall view some date fields in it beside other fields, and now I want to do some modifications on the report parameters before displaying them on the report. How could I do that?
In other words, I want to change the date format from the base page before being displayed on the report.
If you want to show the date in different format, you can change the FormatString of the control that is displaying the date value (for example XRLabel). Set the FormatString to your desired date format (for example "{0:dd-MM-yy}")
If you need to change the value (not the format) of the report parameters, you can do it using the XtraReport event "ParametersRequestSubmit".
Regards.
Related
I have an unbound DataGridView that I populate with data from an SQL database. One of the columns in the database is of type ‘datetime’.
On the load event of my winforms application, I use code below in order to format the column to only show date part of datetime column. However it shows the full datetime. I want 18/02/2020 and it’s showing 18/02/2020 00:00:00
dgv.Columns["Date"].DefaultCellStyle.Format = "dd/MM/yyyy"
dgv.Columns["Date"].ValueType = typeof(System.DateTime);
How do I format the column to only show the date portion of the datetime column?
I added some data in the gridview within my code and tried your code above. The DefaultCellStyle.Format works well.
Which means that you might need to check the way you're retrieving the data from your SQL Database. You may be filling your grid with strings instead of "dates" for example.
I have issue with date formatting mimatch between what is generated by Razor in the view with #Html.DisplayFor and the date I want to show from ajax call.
For some reason the date which is rendered by #Html.DisplayFor shows the format as "2015/04/20 14:14". Then I need to update one row in the view and I make some Ajax call which returns the updated date, I call .ToString on the Date object and it returns the "3/10/2017 2:31:10 PM"
I checked the Thread cultures and they are same when the View is generated and same when it reaches controller, but for some reason #Html.DisplayFor shows different date format.
I don't want to have two different places with date formatting, I want to have one place of generation, I know I can just call ToString in Display method, but I would like to know WHY they differ?
Anybody know this? Thanks
I want to redirect to a page from Rdlc report through hyperlink in a report.it have three parameters id , Startdate, Enddate. Date is not casting properly as it disable hyperlink from column and it doesn't work any suggestion. I casted date in many ways but it does'nt much helpfull.
help please
Im writing a hotel booking system with VS2012 which uses ms sql and in the booking i have two datetimepicker controls. When i select a date in the first one the date automatically gets transfered to the second datetimepicker. I now want when the user opens up the second datetimepicker not being able to select a date that is before the first date from the first datetimepicker. I dont want to use if method displaying a message i just want the dates to be "greyed" out.
Is that possible and how?
*edit (screenshot of how i would like it to be viewed or similar http://i43.tinypic.com/2zpimvs.jpg )
*edit2: its not the control(dateTimePicker2) it self i want to grey out, its the dates inside it that is smaller then the date selected in dateTimePicker1. The screenshot provided is in the area of what im looking for.
You could try this:
DateTimePicker2.MinValue = Convert.toDateTime(DateTimePicker1.SelectedDate);
EDIT
Standard controls don't support the grey-out of a datetimepicker. If you want to do this, you need to subclass the datetimepicker or look at a premade control like a DateEdit from devexpress (i think they even have free controls).
Change the second datepicker MinDate to first DatePicker selected date .. like below ..
rdpDatePicker2.MinDate = rdpDatePicker1.SelectedDate.Value;
I have a popup ajax calendarextender that populates a text box with the selected date, (MM/dd/yyyy). This works. I want to capture the same date in an additional text box with a different format (yyyyMMdd). The first is for display and the second date is a parameter for gridview query. Is this done with two calandarextenders? (btw I'm using C#)
If you are supplying one to a query, you could just change the parameter value in code before supplying it to the query.
var datetimeForQuery = extenderVariable.SelectedDate.ToString("yyyyMMdd");