BC30456: 'DataItem' is not a member of 'System.Web.UI.Control'.

 I am getting compilation error (bold line): BC30456: 'DataItem' is not a member of 'System.Web.UI.Control'.

I am using ASP.NET 2.0 - w/AJAX 2.0 Extension.

 <asp:UpdatePanel UpdateMode="Always" runat="server">
             <ContentTemplate>
                   <asp:LinkButton ID="rateit" runat="server" CssClass="vote" Height="56px" Width="63px"
                             CommandArgument='<%# Container.DataItem("ID") %>'><%# Container.DataItem("votes") %></asp:LinkButton>
              </ContentTemplate>
 </asp:UpdatePanel>

 Any pointers?

 Thanks.

0
itmodule
1/27/2009 1:52:52 AM
asp.net.ajax-discussion 13973 articles. 1 followers. Follow

5 Replies
917 Views

Similar Articles

[PageSpeed] 50

First of all, what is your data source?

Try this: DataBinder.Eval(Container.DataItem, "ID") and DataBinder.Eval(Container.DataItem, "votes")


Christopher Reed
"The oxen are slow, but the earth is patient."
0
Careed
1/27/2009 5:21:59 AM

thanks for the response.

I am binding the gridview with mysql data.

Gridview1.datasource = prod.GetData() -- call to data access layer - returns datatable

Gridview1.databind

The problem is with the updatepanel (i think). because if i remove the updatepanel all works fine.

 

Any ideas?

 

Thanks again.

0
itmodule
1/27/2009 2:08:07 PM

Is the UpdatePanel in your GridView?  If so, the UpdatePanel is preventing you from using the standard data constraints for displaying data on an ASPX page.  The Container.DataItem construct is for direct linkage to the data source associated with a data control.  The use of an UpdatePanel inside a GridView probably adds a layer that prevents its usage.

If the UpdatePanel is external to the GridView, then Container.DataItem is not valid for a non-data control such as the UpdatePanel and the LinkButton.

Of course, regardless of where the UpdatePanel is located, any use of data from outside of the UpdatePanel will probably not be updated properly.


Christopher Reed
"The oxen are slow, but the earth is patient."
0
Careed
1/27/2009 3:17:57 PM

 The Updatepanel is withing Gridview -

 <gridView>

<asp:UpdatePanel UpdateMode="Always" runat="server">
             <ContentTemplate>
                   <asp:LinkButton ID="rateit" runat="server" CssClass="vote" Height="56px" Width="63px"
                             CommandArgument='<%# Container.DataItem("ID") %>'><%# Container.DataItem("votes") %></asp:LinkButton>
              </ContentTemplate>
 </asp:UpdatePanel>

...other controls.

</Gridview>

0
itmodule
1/27/2009 8:07:46 PM

Hi,

Did you need to update LinkButton content or just need set LinkButton as Trigger control so you use UpdatePanel to wrap it?

You can set each LinkButton as Asynchronous trigger on server-side, rather than use UpdatePanel wrap each linkbutton.

In this way, you can define OnRowDataBound event for GridView. In this event, you can register each button as async button.(you need use findcontrol method to find the LinkButton in the current row)

ScriptManager1.RegisterAsyncPostBackControl(control).



Vince Xu
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0
Vince
1/29/2009 7:30:16 AM
Reply:

Similar Artilces:

Error: BC30456: 'DataItem' is not a member of 'System.Web.UI.Control'.
I wanted to create a nested DataList with two dataTables.  I followed the steps.   First, set relation to the two datatables in a dataset ds1.Relations.Add("myRelation", ds1.Tables(0).Columns("intMenuItemID"), ds1.Tables(1).Columns("intParentMenu"))     Second, bind the dataset       DataList1.DataSource = ds1.Tables(0).DefaultView       DataList1.DataBind()   Third, add the following to the DataList datasource property       Container.DataItem.Row.GetChildRows("myRelation") &...

Nested repeater and BC30456: 'DataItem' is not a member of 'System.Web.UI.Control'.
I've got an application where I can make use a nested repeater... I found this Microsoft How To: http://support.microsoft.com/kb/326338/EN-US and attempted to copy that code, but I'm stuck getting the error in the subject. As far as I can tell, my code is all good but for whatever reason it's just not working the way it should. I've posted the code and code-behind pages below, if you have any thoughts on what I can do to fix this please let me know! The line that brings up the compilation error is: <asp:Repeater ID="childRepeater" Runat="server" DataSource='<...

'DataItem' is not a member of 'System.Web.UI.Control'
I was going through the "WEb Matrix Guided Tour" and ran across the following error when I tried to do the section "ASP.NET Pages with Data (SQL Server/MSDE) DataList and Templates". I went through it three times and can not get past this point. Any suggestions would be appreciated. PS: Rookie to this, so please be kind!!! Server Error in '/' Application. -------------------------------------------------------------------------------- Compilation Error Description: An error occurred during the compilation of a resource required to service this requ...

'DataItem' is not a member of 'System.Web.UI.Control'
Hi I am getting this error on my attempt at a repeater control. Any help would be appreciated. This is the code for the HTML <asp:Repeater id="rptTests" runat="server"></asp:Repeater> <ITEMTEMPLATE> <tr style="BACKGROUND-COLOR: #ffecd8"> <td> <%# DataBinder.Eval(Container.DataItem, "test") %> </td> </tr> </ITEMTEMPLATE> This is the cod...

'DataItem' is not a member of 'System.Web.UI.Page'
I am getting this error when compiling the following code: <%@ Import Namespace="System.IO"%><%@ Import Namespace="System.Data.OleDb"%><%@ Import Namespace="System.Data"%><script language="VB" runat="server"> Dim savePath As String = "C:\upload\"Sub Upload_Click(source As Object, e As EventArgs)   If Not (uploadedFile.PostedFile Is Nothing) Then    Try      Dim postedFile = uploadedFile.PostedFile      Dim filename As String = Path.GetFi...

''''''''''''''''''''
Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/1.7.2.0 GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

'System.Web.UI.Control' does not contain a definition for 'DataItem'
Hi, I am getting this error does anyone knows how to solve this :DHighOnCodingWanna get high! Show us the code that produces this error. Other than the exactness of the error, which explains what is exactly happening, we can't see why this is happening without seeing your code.David WierMCP/ASPInsiderASPNet101.com - where to look first!Please Vote for ASPNet101 - 'Best Community Resource'!Control Grouper - easily control properties for multiple controls with one control!Calendar Express - The Best HTML Calendar Generator on the web!(Please 'Mark as Answer' when i...

'System.Web.UI.Control' does not contain a definition for 'DataItem'
Hi, I am recieving this error: 'System.Web.UI.Control' does not contain a definition for 'DataItem' What iam trying to do is when a user clicks the hyperlink column in the datagrid then the ID of that user is send to another page and I need to run the Query or something and bind the Label on the page 2 with the name of the Person. So I am using the HTML view and writing something like this : '<%# DataBinder.Eval(Container.DataItem,"Name") %> ' here is my code behind file so how can i bind the Name of the person with the label: private void Page_Lo...

BC30456: 'text' is not a member of 'System.Web.UI.Control'. Error when trying to assign literal dynamic text
************* Edited by moderator Adec *************** Inserted missing < code></ code> tags. Always include such tags when including code in your postings. Don't force the moderators to do your work. Many readers disregard postings without the code tags. ************************************************** Hello All, Here is a snippet of my code. All i'm doing is looping through a dataset, comparing one of the fields in the dataset with the name of an asp:literal i have in my page and if it maches then assign the asp:literal some text that i also get fro...

Error: Cannot convert type 'System.Web.UI.Control' to 'System.Web.UI.WebControls.ButtonField'
Hello, I am getting the following error during compiliation. Any suggestions to fix it. Thanks. Cannot convert type 'System.Web.UI.Control' to 'System.Web.UI.WebControls.ButtonField' protected void gvEvents_RowCommand(Object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Select") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow selectedRow = gvEvents.Rows[index]; string sID; ButtonField btn; if (selectedRow.RowType == DataControlRowType.DataRow) { sID = ((ButtonField)selectedRow.FindControl("ID")).DataTextFi...

'''''
Name: mario Email: ramar17atfastwebnetdotit Product: Gran Paradiso Alpha 2 Summary: ''''' Comments: K: Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2) Gecko/20070206 GranParadiso/3.0a2 ...

BC30456: 'Value' is not a member of 'System.Web.UI.WebControls.SqlDataSource'.
duplicate post...  Never make important decisions on a Monday!...

BC30456: 'Cells' is not a member of 'System.Web.UI.WebControls.GridViewRowCollection'.
I am trying to grab a value from my gridview that is in the fourth column, but keep getting this error.    I'm trying to get ("FileName") from my gridview so I can process the users request to "delete" the file.  (I have the delete working in the grid view to delete data from the sql table, but I want to use _RowDeleting to also remove the physical file that they uploaded to the fileupload folder)   What am I missing?  BC30456: 'Cells' is not a member of 'System.Web.UI.WebControls.GridViewRowCollection'. Here's...

error BC30456: 'DataTable' is not a member of 'System.Web.UI.UserControl'
Help me to solve this eRims\WebErims\WebErims\Common\CommonBrowser.ascx.vb(13,0): error BC30456: 'DataTable' is not a member of 'System.Web.UI.UserControl'.G:\eRims\WebErims\WebErims\Common\CommonBrowser.ascx.vb(16,0): error BC30456: 'DataTable' is not a member of 'System.Web.UI.UserControl'.G:\eRims\WebErims\WebErims\Common\CommonBrowser.ascx.vb(22,0): error BC30456: 'HeaderText' is not a member of 'System.Web.UI.UserControl'.G:\eRims\WebErims\WebErims\Common\CommonBrowser.ascx.vb(25,0): error BC30456: 'HeaderText' is not a member of 'System.Web.UI.UserControl'.G:\eRims\WebErims\WebErims\Common\CommonBrowser.ascx.vb(31,0): error BC30456: 'MapNames' is not a member of 'System.Web.UI.UserControl'.G:\eRims\WebErims\WebErims\Common\CommonBrowser.ascx.vb(34,0): error BC30456: 'MapNames' is not a member of 'System.Web.UI.UserControl'.G:\eRims\WebErims\WebErims\Common\CommonBrowser.ascx.vb(40,0): error BC30456: 'WidthInPixel' is not a member of 'System.Web.UI.UserControl'.G:\eRims\WebErims\WebErims\Common\CommonBrowser.ascx.vb(43,0): error BC30456: 'WidthInPixel' is not a member of 'System.Web.UI.UserControl'.G:\eRims\WebErims\WebErims\Common\CommonBrowser.ascx.vb(49,0): error BC30456: 'DataFormat' is not a member of 'System.Web.UI.UserControl'.G:\eRims\WebErims\WebErims\Common\CommonBrowser.ascx.vb(52,0): error BC30456: 'DataFor...

error BC30456: 'CurrentDate' is not a member of 'System.Web.UI.UserControl'
Does anyone know what's causing this error. I got it when I try ro publish this site using .net 2.0. Thanks in advance for your help. Default.aspx:<%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>  <%@ Register TagPrefix="GD" TagName="GetDate" Src="GetDate.ascx" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <...

'System.Web.UI.IDataItemContainer.DataItem' is a 'property' but is used like a 'method'
On the line "<%# Container.DataItem("BlogID") %>", I get the error listed in the title of this post. I'm not sure why, I use this same for on other pages to get data from a database and I don't get this error.         <asp:GridView ID="GridView1"         runat="server"         AutoGenerateColumns="False"         DataKeyNames="BlogID"        D...

'System.Web.UI.Control.Context' denotes a 'property' where a 'class' was expected
I get the following error when trying to compile my project. The call to Context lies in a usercontrol. It works fine when called from a page, but how do I call it from a usercontrol? private User _currentUser = new User(Context.User.Identity.Name); 'System.Web.UI.Control.Context' denotes a 'property' where a 'class' was expected Firefox - The browser you can trust Update: private User _currentUser = new User(Context.User.Identity.Name);Is declared inside the class, not in a function. Like: public class Someclass : System.Web.UI.UserControl { private User _currentUser = new...

Value of type 'System.Web.UI.Control' cannot be converted to 'System.Web.SiteMap'.
 Hello,         I receive this error "System.Web.UI.Control' cannot be converted to 'System.Web.SiteMap" when I try to find the Sitemap control.  ...            <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />            <asp:ListView ID="ListView1" runat="server">            <LayoutTemplate>    ...

ASPNET2 HELP! CS0266: Cannot implicitly convert type 'System.Web.UI.Control' to 'System.Web.UI.WebControls.FileUpload'.
Server Error in '/start-movieposters' Application. Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0266: Cannot implicitly convert type 'System.Web.UI.Control' to 'System.Web.UI.WebControls.FileUpload'. An explicit conversion exists (are you missing a cast?) Source Error: ...

'System.Web.UI.WebControls.DataListItem.DataItem' is a 'property' but is used like a 'method'
 HI I have a datalist with OnItemDataBoundI get the following error when I try to get the DataItem 'System.Web.UI.WebControls.DataListItem.DataItem' is a 'property' but is used like a 'method' , any idea what's wrong with the line ?  public void Item_Bound(object sender, DataListItemEventArgs e)    {        Label originalPriceLabel;        if (e.Item.ItemType == ListItemType.Item | e.Item.ItemType == ListItemType.AlternatingItem)        {            originalPriceLabel = ((Label)(e.Item.FindControl("originalPriceLabel")));            decimal result = Convert.ToDecimal(e.Item.DataItem("originalPrice"));            if (result < 1)            {                originalPriceLabel.Visible = false;            }            else            {                originalPriceLabel.Visible = true;      &nb...

Getting 'System.Web.UI.Control' does not contain a definition for 'DataItem' error on controls when placed inside an update panel which is in a template.
Using the June CTP, I;ve got an updatepanel inside the itemtemplate of a datalist which is now suppopsed to be supported (it works). I also have some asp controls (imagebutton, label) which get their values dynamically (DataBinder.Eval(Container.DataItem, "fieldname").ToString(). This would work fine before putting the updatepanel in the datalist itemtemplate, I now get the error in the title when building ('System.Web.UI.Control' does not contain a definition for 'DataItem') for each control... How can I dynamically assign the values to the controls in the datalist when also using updatepanels? Sample below, works fine without the updatepanel...  <asp:DataList ID="DataList1" OnItemCommand="DataListCommand" runat="server" RepeatColumns="4" RepeatDirection="Horizontal" HorizontalAlign="Center" CellPadding="0">                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />                        <ItemTemplate>                        <atlas:UpdatePanel ID="UpdatePanel1" runat="server" Mode="Conditional">             &...

'DisplayDataFromPage' is not a member of 'System.Web.UI.MasterPage'.
 I try to use DisplayDataFromPage method in content page and display value in the masterpage via MasterPage's method called DisplayDataFromPage (the same), but still it says:  'DisplayDataFromPage' is not a member of 'System.Web.UI.MasterPage'. Masterpage3.master.vb  Inherits System.Web.UI.MasterPagePublic Sub DisplayDataFromPage(ByVal strodbalance As Double) lblodbalance.Text = strodbalance End SubPublic ReadOnly Property DataFromPageLabelControl() As Label GetReturn Me.lblodbalance End Get End Property cashstatement.vb Inherits Syste...

'System.Web.UI.Control' cannot be converted to 'String'.
I am trying to run a simple Edit, Update, Delete. I found a simple example in a book I've got. My only concern is withing the string it's first Declaration is Read only, so it won't be edited. and for some reason I am getting this error: The update function that is right after the page_load is giving me the problems. Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30311: Value of type 'Sy...

'Find' is not a member of 'System.Web.UI.ControlCollection'.
I have 5 rows (2 textboxes and 1 dropdownlist on each row)...named like txtDate1/txtHours1/ddlType1 (row 1), txtDate2/txtHours2/ddlType2 (row 2)...and so on. On each row, if the user has put data in one of the textboxes, then the other one need to have data as well.  If they both have info...fine, if they both don't have info...fine.  Anyway, I'm trying to streamline my saving procedure with a loop, but I'm having problems. Here's my code     Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles bt...

Web resources about - BC30456: 'DataItem' is not a member of 'System.Web.UI.Control'. - asp.net.ajax-discussion

Resources last updated: 2/21/2016 5:56:55 AM