Wednesday, 15 January 2014

c# - adding Rows on devexpress Grid using for loop in datatable -



c# - adding Rows on devexpress Grid using for loop in datatable -

i new on devexpress,so have simple question here.what equal of code on devexpres gridview.

for(int i=0;i<dtable.rows.count;i++) { mygridview.rows.add(); mygridview.rows[i].cells[0].value =dtable.rows[i][0].tostring(); mygridview.rows[i].cells[1].value = dtable.rows[i][1].tostring(); }

the grid not store data. means, must add together rows datasource forcefulness command display them. here simple code this:

public class record { public record(int id) { this.id = id; this.data = string.format("record {0}", id); } public int id { get; set; } public string info { get; set; } } public partial class form1: form { public form1() { initializecomponent(); } private void form1_load(object sender, eventargs e) { bindinglist<record> datasource = new bindinglist<record>(); gridcontrol1.datasource = datasource; for(int = 0; < 10; i++) datasource.add(new record(i)); } }

c# devexpress

No comments:

Post a Comment