Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
455
TemplateRowOnBottom and empty datasource
posted

Hi

 

I have a empty datasource that I bind to the wingrid. When the user clicks on "Add New" button, I set the property on the grid

grid.DisplayLayout.Override.AllowAddNew = AllowAddNew.TemplateOnBottom;

I can see the template row added to the gird. But am not able to edit it. I tried setting these properties as well..

grid.DisplayLayout.Override.AllowUpdate =

DefaultableBoolean.True;

lookupValuesGrid.DisplayLayout.Override.CellClickAction = CellClickAction.Edit;

Still I am not able to edit it.

Any pointers will be helpful.

 

Thanks

Parents
No Data
Reply
  • 12333
    posted

    Hi,

    I would like to recommend that you set these properties in the WinGrid control's InitializeLayout event. Here is some example code:

            private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
            {
                e.Layout.Override.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.TemplateOnBottom;
               
               
                e.Layout.AutoFitStyle = Infragistics.Win.UltraWinGrid.AutoFitStyle.ResizeAllColumns;
                e.Layout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.Edit;

    >>>>>> code omitted for brevity

     

    Here are some other tips / example code for when working with WinGrid add / saving rows:

     

            //Add button
            private void ultraButton1_Click(object sender, EventArgs e)
            {
                //Adds a new instance of your underlying data object to the collection using
                //the data collection's IBindingList.AddNew( ) functionality
                this.ultraGrid1.DisplayLayout.Bands[0].AddNew();
            }

            //Save button
            private void ultraButton2_Click(object sender, EventArgs e)
            {
                //Simulates moving off the cell so that the value in the grid editor gets put into the
                //underlying object's property
                this.ultraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.ExitEditMode);
                //commits the value changes to the current list object
                this.ultraGrid1.UpdateData();

                //then resolve the changes to your database.
            }

     

Children
No Data