We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Date column question...

Thread ID:

Created:

Updated:

Platform:

Replies:

24507 Feb 4,2005 08:26 PM UTC Feb 6,2005 07:52 PM UTC WinForms 1
loading
Tags: GridControl
Jim Frapper
Asked On February 4, 2005 08:26 PM UTC

Greetings, I have a date column in a databound grid I am setting up with the following code. this.gridData.Model.ColStyles[5].CellType = "DropDownMonthCalendar"; this.gridData.Model.ColStyles[5].CellValue = System.DateTime.Now; As you can see I want to default in todays date for all new rows in the grid. This is a bulk entry screen. The odd behavior I am experiencing is the following: - When the screen is first loaded the first row is empty with the exception of the date column(this is what I want). As soon as I type in or select another column on this row the grid makes a new row(I have the enable add new property set to true) and removes the date value from my first row(what I don''t want). Essentially, I want this date column to default to today''s date for all new rows added, but allow the user to change it if they want. Cheers, JF

Administrator [Syncfusion]
Replied On February 6, 2005 07:52 PM UTC

Jim, use the following code to fill the AddNew row with default values. The code will be execute the moment the user starts editing the AddNew row. this.gridDataBoundGrid1.Binder.EditModeChanged += new EventHandler(Binder_EditModeChanged); private void Binder_EditModeChanged(object sender, EventArgs e) { Syncfusion.Windows.Forms.Grid.GridModelDataBinder binder = sender as Syncfusion.Windows.Forms.Grid.GridModelDataBinder; if (binder.IsAddNew) { int rowIndex = binder.CurrentRowIndex; this.gridDataBoundGrid1.Model[rowIndex, 5].CellValue = System.DateTime.Now; } } Stefan >Greetings, > >I have a date column in a databound grid I am setting up with the following code. > >this.gridData.Model.ColStyles[5].CellType = "DropDownMonthCalendar"; > this.gridData.Model.ColStyles[5].CellValue = System.DateTime.Now; > >As you can see I want to default in todays date for all new rows in the grid. This is a bulk entry screen. > >The odd behavior I am experiencing is the following: >- When the screen is first loaded the first row is empty with the exception of the date column(this is what I want). As soon as I type in or select another column on this row the grid makes a new row(I have the enable add new property set to true) and removes the date value from my first row(what I don''t want). > >Essentially, I want this date column to default to today''s date for all new rows added, but allow the user to change it if they want. > >Cheers, >JF > >

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;