DataGrid column size (Compact Framework) C# -
i'm new datagrids.
my code:
private void populategrid() { conn.open(); string query; query = "select company_id_no, company_name, last_update_datetime, username company"; oracledataadapter da = new oracledataadapter(query, conn); oracledataset ds = new oracledataset(); da.fill(ds); dgsku.datasource = ds.tables[0]; }
this how looks on mobile device:
i want automatically re-size columns 100%, like:
i appreciate if can point me in right direction.
thanks in advance!
string query; query = "....sql..."; { conn.open(); using (oracledataadapter = new oracledataadapter(query, conn)) { datatable t = new datatable(); a.fill(t); dgsku.tablestyles.clear(); datagridtablestyle tablestyle = new datagridtablestyle(); tablestyle.mappingname = t.tablename; foreach (datacolumn item in t.columns) { datagridtextboxcolumn tbcname = new datagridtextboxcolumn(); tbcname.width = 80; tbcname.mappingname = item.columnname; tbcname.headertext = item.columnname; tablestyle.gridcolumnstyles.add(tbcname); } dgsku.tablestyles.add(tablestyle); } }
Comments
Post a Comment