Welcome Guest Search | Active Topics | Sign In | Register

Eo.webgrid problem Options
Sivaram
Posted: Saturday, October 3, 2009 2:36:03 PM
Rank: Newbie
Groups: Member

Joined: 10/3/2009
Posts: 1
Hi everybody,

Please tell me how to populate the eo.webgrid. I programmatically create a datatable and bind it to the grid when application is running grid is not visible but asp gridview is working fine what is the main difference. I'm new to this controls please help me.

Thanks in advance.

My code is like this:

<table>
<tr>
<td>
<eo:Grid ID="gvw1" runat="server" AllowNewItem="true">
<Columns>
<eo:RowNumberColumn HeaderText="SI No" />
</Columns>
</eo:Grid>

</td>
<td>
<asp:GridView ID="gvw" runat="server" AutoGenerateColumns="true" />
</td>

</tr>
</table>

code behind:

protected void Page_Load(object sender, EventArgs e)
{
DataSet ds = new DataSet();
DataTable dt = new DataTable();
DataColumn col1 = new DataColumn("First Name", typeof(string));
DataColumn col2 = new DataColumn("Full Name", typeof(string));
dt.Columns.Add(col1);
dt.Columns.Add(col2);

DataRow dr1 = dt.NewRow();
dr1[0] = "Mike";
dr1[1] = "Taylor";
dt.Rows.Add(dr1);
DataRow dr2 = dt.NewRow();
dr2[0] = "Neil";
dr2[1] = "Johnson";
dt.Rows.Add(dr2);

gvw.DataSource = dt;
gvw.DataBind();

gvw1.DataSource = dt;
gvw1.DataBind();

}
eo_support
Posted: Saturday, October 3, 2009 2:39:45 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You need to manually define all the columns. EO.Web Grid does not automatically create columns like ASP.NET GridView does. Please see here for more details:

http://doc.essentialobjects.com/library/1/grid/start.aspx

Thanks!

farzad
Posted: Monday, October 5, 2009 3:31:29 PM
Rank: Newbie
Groups: Member

Joined: 8/10/2007
Posts: 5
I have the exact same problem. Please note that I did manually add the columns per documentation instructions but the data does not display. Interestingly enough, the number of rows do reflect the number of rows in the DataTable.
eo_support
Posted: Monday, October 5, 2009 3:37:47 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi Farzad,

As long as you see rows, data binding should be working for you. If you still have problems, please post a complete test page that demonstrates the problem and we will be happy to take a look. Please make sure the test page runs and demonstrates the problem.

Thanks
farzad
Posted: Monday, October 5, 2009 3:42:38 PM
Rank: Newbie
Groups: Member

Joined: 8/10/2007
Posts: 5
I figured the problem! The issue was that I was setting the 'Name' property for the column whereas the control expects the 'Data Field' property to be set in accordance with the DataTable column definition.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.