How to Implement this

2 posts, 0 answers
  1. Waleed Seada
    Waleed Seada avatar
    241 posts
    Member since:
    May 2006

    Posted 12 Dec 2009 Link to this post

    Dear All,

    I have a radgrid on one of my UserControls that I need to display data.
    1: Data grid needs to show three columns with no data when the usercontrol is loaded.
    I put this code in the page_load of the usercontrol:
    DataTable dt = new DataTable();  
    dt.Columns.Add("Source"typeof(string));  
    dt.Columns.Add("Value"typeof(string));  
    IdentifiersGrid.DataSource = dt; 
    BUT the grid doesn't show anything when loaded, If I put the previous code in the Need_DataSource event it shows the columns.

    2: I have a button on the usercontrol that will fill the grid with data, where I create a datatable and fill with data as follows:
    dt.Rows.Add(ids[0].Value, ids[1].Value); 
    I get an exception "Input array is longer than the number of columns in this table."

    What is wrong with this, can someone help

    Best regards
    Waleed
  2. Waleed Seada
    Waleed Seada avatar
    241 posts
    Member since:
    May 2006

    Posted 12 Dec 2009 Link to this post

    Sorry Guys for any inconvenience

    Just figure out that I need to add the columns to the datatable first.


    Waleed
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top