Skip to content

Infragistics Community Forum / Web / Ultimate UI for ASP.NET Web Forms / WebDataGrid – Adding new row and column

WebDataGrid – Adding new row and column

New Discussion
S.S. Steve
S.S. Steve asked on Jan 19, 2018 1:43 AM

Hi all!

I’m a beginner of infragistic. I have encountered several problems and here are my questions:

The image below is the result of the web data grid.

1. What should I consider if I want to add a column and a row?

I’m not sure if my question is suitable to post here. If not, sorry for inconvenience!

Thank you for your help.

Sign In to post a reply

Replies

  • 0
    [Infragistics]Tacho
    [Infragistics]Tacho answered on Jan 15, 2018 1:33 PM

    Hello Steve,

    Thank you for the screenshot you have provided.

    1. In order to add a new row to the WebDataGrid, I can suggest you use either the built-in add new row interface or by doing it client-side through JavaScript.

    a) Add new row with built-in interface will require the following behaviors for the WebDataGrid:

        
            
                                            
            
        
         // This will commit the new row when it gets unfocused.
    

    b) Add new row client-side through JavaScript:

    
    
    

    2. In order to add a new column to the WebDataGrid, you can simply create a new UnboundField (or BoundDataField for existing underlying properties of the DataItems) instance and add it to the Columns collection of the WebDataGrid.

    Form:

    
    

    C#:

    protected void addColumn_Click(object sender, EventArgs e)
    {
        AddColumn("NEW COLUMN", "NEW COLUMN HEADER");
    }
    private void AddColumn(string fieldName, string headerText)
    {
        UnboundField field = new UnboundField();
        field.Key = fieldName;
        field.Header.Text = headerText;
        field.DataType = "System.String";
        field.Width = Unit.Pixel(150);
    
        dataGrid.Columns.Add(field);
    }
    

    For more details on adding rows and columns to the WebDataGrid, I can suggest you take a look at the following samples and topics:Row AddingColumn AddingUnboundColumn sample

    I have attached a sample application that demonstrates the approaches from above. (Please note that in order to run it, you may need to modify the build version of the registered assemblies.)If you have any questions, please let me know.

    Sincerely,TachoEntry-Level Software Developer

    • 0
      S.S. Steve
      S.S. Steve answered on Jan 19, 2018 1:43 AM

      Hello Tacho,

      Thank you for your help!

      It works for me!!

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
S.S. Steve
Favorites
0
Replies
2
Created On
Jan 19, 2018
Last Post
8 years, 8 months ago

Suggested Discussions

Created by

Created on

Jan 19, 2018 1:43 AM

Last activity on

Feb 20, 2026 1:19 PM