pratikshahse
asked on
Populate a DataGrid or Gridview
I want to populate a datagrid and the data is not going ot come from any database. what i have is an object and i am going through loop through different values in that object and then populate the datagrid with the values that I get after each loop.
this is what i want to do:
loop through object:
{
string x = object.somevalue
string y = object.somevalue
populatedgrid(x,y)
}
Function populategrid (sting x, string y)
populate grid by appending new values.
this is what i want to do:
loop through object:
{
string x = object.somevalue
string y = object.somevalue
populatedgrid(x,y)
}
Function populategrid (sting x, string y)
populate grid by appending new values.
Are the number of columns predefined?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
myGridView.DataSource = <your object name goes here>;
myGridView.DataBind();
myGridView.DataBind();
It needs to be done like, Create a datatable, Add object values into the datatable, just bind the datatable.
thats it
thats it