Pergunta

I have binded xtragrid for Windows Application through program, I have added 2 data tables into dataset and dataset is binded to datasource.

//...
DataSet ds = new DataSet();
ds.Tables.Add(GetCustomerDetails());
ds.Tables.Add(GetIdDetails());
ds.Relations.Add("Id Details", ds.Tables[0].Columns["NameID"], ds.Tables[1].Columns["NameID"]);
gridControl1.DataSource = ds; 
//...
DataTable GetCustomerDetails()
{
    Con.Open();

    SqlDataAdapter da = new SqlDataAdapter("select  tblCustSupp.NameID,Surname,FirstName from tblCustSupp where tblCustSupp.NameID IN(19471,19475)", Con);
    DataTable dt = new DataTable();
    da.Fill(dt);
    Con.Close();
    return dt;
}
DataTable GetIdDetails()
{
    Con.Open();
    SqlDataAdapter da = new SqlDataAdapter("Select NameID,IDType,IDIssued from tblID Where NameID IN(19471,19475)", Con);
    DataTable dt = new DataTable();
    da.Fill(dt);
    Con.Close();
    return dt;
}

When I run this application, it shows blank row and one arrow in first Column by clicking on that arrow i can see the data in my XtraGrid. How to remove this blank row?

Foi útil?

Solução

Give the DataTables names and bind the name to the xtragrid.

gridControl1.DataMember = "YourDataTableName";
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top