Dear Friends,
I m using a Webdatetimeedit in Ultrawebgrid column.
For this column i have set the datatype as System.Datetime and Format as dd/MM/yyyy.
My Ultrawebgrid has add row button(AddnewBox) which adds the new row to Ultrawebgrid
And for the Webdatetimeedit I have set the following properties
<igtxt:webdatetimeedit id="WebDateTimeEdit1" runat="server" Width="106px" EditModeFormat="dd/MM/yyyy " DisplayModeFormat="dd/MM/yyyy"></igtxt:webdatetimeedit>
On Pageload event I don't have any row in my ultrawebgrid.So user can add the row using add button.After adding row When i edit the Column and set the date as "01/01/2010" in the cell it ( it shows me the Proper value of cell as "01/01/2010") saves the Date but when
I edit the column and set the date as "25/01/2010" in the cell it gives me the error because at runtime it shows me the value of cell as nothing instead of "25/01/2010"
Hi,
I tested sample where grid has no rows, has addNewButton and editor with dd/MM/yyyy. It worked ok and picked up value of date, persisted it, could edit cell after a postback after after editing new row or cell in existing row.
If grid has custom editor, then there is no need to set Format of column.Maybe after a postback something happens to grid settings: column editor is lost or cell value is in wrong format. Try to experiment with simplest possible application (grid and editor on form and only initialization codes for grid and its editor) and test if it works correctly.
I had codes as below.
aspx:
<igtxt:WebDateTimeEdit ID="WebDateTimeEdit1" runat="server" EditModeFormat="dd/MM/yyyy"></igtxt:WebDateTimeEdit><igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server" OnInitializeLayout="UltraWebGrid1_InitializeLayout" ... > <displaylayout ... AllowAddNewDefault="Yes"> ...
aspx.cs:
protected override void OnInit(EventArgs e){ base.OnInit(e); this.UltraWebGrid1.InitializeDataSource += new Infragistics.WebUI.UltraWebGrid.InitializeDataSourceEventHandler(UltraWebGrid1_InitializeDataSource);}void UltraWebGrid1_InitializeDataSource(object sender, Infragistics.WebUI.UltraWebGrid.UltraGridEventArgs e){ DataTable dt = new DataTable("Customer"); dt.Columns.Add("CustomerID", typeof(int)); dt.Columns.Add("CustomerName", typeof(string)); dt.Columns.Add("Address", typeof(string)); dt.Columns.Add("Date", typeof(DateTime)); this.UltraWebGrid1.DataSource = dt;}protected void UltraWebGrid1_InitializeLayout(object sender, Infragistics.WebUI.UltraWebGrid.LayoutEventArgs e){ this.UltraWebGrid1.Columns[3].EditorControlID = this.WebDateTimeEdit1.UniqueID; this.UltraWebGrid1.Columns[3].Type = Infragistics.WebUI.UltraWebGrid.ColumnType.Custom;}
Hi Viktor ,
I tried your code I didn't understood your approach.If I remove the column setting format System.Datetime it does not allow to edit the date in dateformat it act as if im typing any
string in it.Why do I need InitializeDataSource event ,InitializeLayout event? I m not going to bind any data.My grid has 7 to 8 columns on postback it clears the date column(or cell) . but retains and shows the information of all 7 columns and rows added(via addnew button).
It clears the date when and only when the date is above 12 of specific month.
Like '13/12/2010','14/12/2010','16/1/2010' etc
It has been 20 days I m trying pls victor I need Help
Regards
Chandrakant