473,396 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Datagrid error

Hi,

I am getting below error while using the ItemTemplate in datagrid. Please
help, this is very very urgent.

CS0117: 'System.Web.UI.DataBinder' does not contain a definition for 'eval'

Below is my code to populate datagrid.

HTML Code:

<asp:datagrid id="dgSettings" runat="server"
OnItemDataBound="DG_itemdatabound1" width="100%" headerCSS="tblHeader"
bodyCSS="tblBody" autogeneratecolumns="False" GridLines="Horizontal"
BorderColor="#E0E0E0" BackColor="White" bodyHeight="400" AllowSorting="True"
AllowPaging="True" AllowCustomPaging="True">
<Columns>
<asp:TemplateColumn HeaderText="Entity">
<ItemTemplate>
<asp:label ID="name" text='<%#DataBinder.eval(Container.DataItem,"Name" )%>'
Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Display">
<ItemTemplate>
<asp:CheckBox ID = "chkdisplay" runat="server" Checked=
'<%#cbool(DataBinder.eval(Container.DataItem,"disp lay"))%>' OnCheckedChanged
= "ChangeSelection">
</asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>

C# Code:

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
Bindgrid();
}

private void Bindgrid()
{
string connstring = ConfigurationSettings.AppSettings["userprefconnstring"];
SqlConnection SQLConn = new SqlConnection(connstring);
SQLConn.Open();
SqlDataReader DR;
SqlCommand Cmmd;
String test = "9840da5f-1ede-da11-bd26-001125ac3fe6";
string strquery="Select Name,Display, Rollup from tbl_UserPreferences where
UserId='" + test +"' order by Name";
Cmmd = new SqlCommand(strquery, SQLConn);
Cmmd.CommandType = CommandType.Text;
DR = Cmmd.ExecuteReader();
if (DR.HasRows)
{
dgSettings.DataSource = DR;
dgSettings.DataBind();
}
else
{
lblerrormsg.Text = "0 Records Retrieved.";
}
DR.Close();
SQLConn.Close();
}

Thanks,
Ashwani
Jun 20 '06 #1
1 1541
Hi,
Remember, C# is case sensitive, try Eval instead of eval
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Ashwani" <As*****@discussions.microsoft.com> wrote in message
news:16**********************************@microsof t.com...
Hi,

I am getting below error while using the ItemTemplate in datagrid. Please
help, this is very very urgent.

CS0117: 'System.Web.UI.DataBinder' does not contain a definition for
'eval'

Below is my code to populate datagrid.

HTML Code:

<asp:datagrid id="dgSettings" runat="server"
OnItemDataBound="DG_itemdatabound1" width="100%" headerCSS="tblHeader"
bodyCSS="tblBody" autogeneratecolumns="False" GridLines="Horizontal"
BorderColor="#E0E0E0" BackColor="White" bodyHeight="400"
AllowSorting="True"
AllowPaging="True" AllowCustomPaging="True">
<Columns>
<asp:TemplateColumn HeaderText="Entity">
<ItemTemplate>
<asp:label ID="name"
text='<%#DataBinder.eval(Container.DataItem,"Name" )%>'
Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Display">
<ItemTemplate>
<asp:CheckBox ID = "chkdisplay" runat="server" Checked=
'<%#cbool(DataBinder.eval(Container.DataItem,"disp lay"))%>'
OnCheckedChanged
= "ChangeSelection">
</asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>

C# Code:

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
Bindgrid();
}

private void Bindgrid()
{
string connstring =
ConfigurationSettings.AppSettings["userprefconnstring"];
SqlConnection SQLConn = new SqlConnection(connstring);
SQLConn.Open();
SqlDataReader DR;
SqlCommand Cmmd;
String test = "9840da5f-1ede-da11-bd26-001125ac3fe6";
string strquery="Select Name,Display, Rollup from tbl_UserPreferences
where
UserId='" + test +"' order by Name";
Cmmd = new SqlCommand(strquery, SQLConn);
Cmmd.CommandType = CommandType.Text;
DR = Cmmd.ExecuteReader();
if (DR.HasRows)
{
dgSettings.DataSource = DR;
dgSettings.DataBind();
}
else
{
lblerrormsg.Text = "0 Records Retrieved.";
}
DR.Close();
SQLConn.Close();
}

Thanks,
Ashwani

Jun 20 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mad Scientist Jr | last post by:
I am getting an error in my code that references a textbox inside the current row of my datagrid, whenever I try changing the page (paging is enabled). This code doesn't even run unless a button in...
3
by: Ruy Castelli | last post by:
Hello, I'm trying to get the details out of a datagrid component and it works fine when I'm accessing the first page of the datagrid, but when I try to click on the details hyperlink for an item...
2
by: Mike P | last post by:
I have a datagrid with a 'Delete' column that the user can click on to delete a row in the datagrid. I thought that I would need to have some kind of error handling in case somebody goes into the...
3
by: CVerma | last post by:
Hi, I have an embedded datagrid within a datalist. I am not able to perfrom paging in the datagrid. Any ideas? Here is my code: Here is my Simplegrid.cs file: using System; using...
9
by: tshad | last post by:
How do I find (and set) a couple of labels in the Footer after a DataGrid is filled? I have a bunch of DataGrids that get displayed nested inside a DataList. The datagrid looks like: ...
5
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated...
17
by: A_PK | last post by:
I have problem databinding the DataGrid with DataView/DataSet after the filter... I create the following proceudre in order for user to filter as many as they want, but the following code is only...
0
by: Chris | last post by:
I've been searching all over and think I am close, but keep getting the error "Index out of range" when trying to reference a nested datagrid when an OnEditCommand event is raised. When the...
2
by: Flack | last post by:
I have a DataGrid and a DataTable. When my form loads I create the DataTable with the appropriate columns and use it for the DataGrids.DataSource. Later on in my app, I alter the DataTable: ...
7
by: julian.tklim | last post by:
Hi, I need to build an editable Datagrid with add & delete buttons on each row using javascript. DataGrid need not be pre-populated with values. To make the thing complicated, one of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.