locked
Can not show data on datagrid RRS feed

  • Question

  • Hi everybody
    I'm using DataGridTableStyle format my datagrid style.
                DataGridTableStyle tableStyle = new DataGridTableStyle();
    
    
    
    
    
    
    
                DataGridColumnStyle colStyle1 = new DataGridTextBoxColumn();
    
    
    
                colStyle1.HeaderText = "ID";
    
    
    
                colStyle1.MappingName = "ID";
    
    
    
                colStyle1.Width = 90;
    
    
    
                
    
    
    
    
    
    
    
                DataGridColumnStyle colStyle2 = new DataGridTextBoxColumn();
    
    
    
                colStyle2.HeaderText = "Name";
    
    
    
                colStyle2.MappingName = "Name";
    
    
    
                colStyle2.Width = 120;
    
    
    
                
    
    
    
                tableStyle.GridColumnStyles.Add(colStyle1);
    
    
    
                tableStyle.GridColumnStyles.Add(colStyle2);
    
    
    
    
    
    
    
                dataGrid1.TableStyles.Clear();
    
    
    
                dataGrid1.TableStyles.Add(tableStyle);
    dataGrid1.DataSource = fxService.GetAllSupplier(); //call webservice method.

    if my datasource form Web Service then datagrid can't show data. I'm sure web service has retrun 5 record.
    Web Service Ruten value -> (object type) List<comCustomer>

    but, if my datasource form LocalDataBase(SQLCE) then It's normal.
    • Edited by SCCY_ITSD Tuesday, April 21, 2009 5:47 AM
    Tuesday, April 21, 2009 2:56 AM

Answers

  • The problem has solve

    DataGridTableStyle.MappingName = "comCustomer";

    Ilya Tumanov Thanks for help.
    • Marked as answer by SCCY_ITSD Tuesday, April 21, 2009 6:26 AM
    Tuesday, April 21, 2009 6:26 AM

All replies

  • I'm not sure what you mean by "if my datasource form Web Service then datagrid can't show data" but your code has at least one issue - you never set table mapping name which makes your attempt to set style pretty much useless.


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Tuesday, April 21, 2009 3:50 AM
  • Thank you Ilya Tumanov

    How do I set table mapping name if dataType is List<comCustomer> from WebService.
    Tuesday, April 21, 2009 5:53 AM
  • The problem has solve

    DataGridTableStyle.MappingName = "comCustomer";

    Ilya Tumanov Thanks for help.
    • Marked as answer by SCCY_ITSD Tuesday, April 21, 2009 6:26 AM
    Tuesday, April 21, 2009 6:26 AM