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
40
ultraweb grid abiltiy to add columns dynamically
posted

Hi,

I have a ultrawebgrid with the ability to add rows on click of a button and trying to do the same with the columns.when the user clicks add columns button he will enter the number of columns he want and the columns added should be of text boxes that is they  should be editable. I have seen below code but it will not help me in what i am trying to do number of columns but not a single column since it has the key name as one.Any help is really appreciated. Thanks in advance.

protected override void OnInit(EventArgs e)

    {

        base.OnInit(e);

        // Create a templated column

        TemplatedColumn col = new TemplatedColumn(true);

        this.UltraWebGrid1.DisplayLayout.Bands[0].Columns.Add(col);

        col.Key = "CheckBoxCol";

        col.Header.Caption = "";

        GridHeaderTemplate tempHeader = new GridHeaderTemplate();

        // Set the header template.

        col.HeaderTemplate = tempHeader;

        this.UltraWebGrid1.DataSource = LoadGrid();

        this.UltraWebGrid1.DataBind();

    }

 

Thanks,

Swetha

  • 49378
    posted

    Hi Swetha,

    It has been some time since your post, however in case you still need assistance I would be glad to help.

    From what I can understand you are experiencing issues with assigning unique keys when adding multiple columns. In this scenario you should be able to use an integer value (such as the current number of columns) as a suffix when creating the column Key. For instance:

    col.Key = "CheckBoxCol" + uwg.DisplayLayout.Bands[0].Columns.Count.ToString();

    Please note that the UltraWebGrid control is now outdated and as of .NetAdvantage 2011 Volume 2 is no longer included in our product package. I would suggest that you consider switching to the WebDataGrid/WebHieararchicalDataGrid. More information regarding these controls is available at:

    http://help.infragistics.com/NetAdvantage/ASPNET/2011.2/CLR4.0/?page=Web_WebDataGrid_WebDataGrid.html


    Additional samples demonstrating the features of these grids can be found at:
    http://samples.infragistics.com/aspnet/

    Feel free to contact me if you have any questions.