473,382 Members | 1,380 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,382 software developers and data experts.

The name 'blMessages' does not exist in the current context

Hi

I'm using VS2005. I get the above error when trying to build the solution.
Intellisense is OK.

// Code behind
protected void odsPublication_Inserted(object sender,
ObjectDataSourceStatusEventArgs e)
{
if (e.Exception == null)
{
blMessages.Visible = false;
}
}

//This is the webcontrol and ObjectDataSource

<asp:BulletedList ID="blMessages" runat="server" ForeColor="Red"
Visible="False">
</asp:BulletedList>
<asp:ObjectDataSource ID="odsPublication" runat="server"
InsertMethod="AddPublication"
OnInserted="odsPublication_Inserted">
<SelectParameters>
....

</SelectParameters>
<InsertParameters>
....
</InsertParameters>
</asp:ObjectDataSource>

Can you tell me what it really means and how to fix it?

Thanks
Andrew
Jan 9 '07 #1
3 5201

"J055" <j0**@newsgroups.nospamwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Hi

I'm using VS2005. I get the above error when trying to build the solution.
Intellisense is OK.

// Code behind
protected void odsPublication_Inserted(object sender,
ObjectDataSourceStatusEventArgs e)
{
if (e.Exception == null)
{
blMessages.Visible = false;
}
}

//This is the webcontrol and ObjectDataSource

<asp:BulletedList ID="blMessages" runat="server" ForeColor="Red"
Visible="False">
</asp:BulletedList>
<asp:ObjectDataSource ID="odsPublication" runat="server"
InsertMethod="AddPublication"
OnInserted="odsPublication_Inserted">
<SelectParameters>
...

</SelectParameters>
<InsertParameters>
...
</InsertParameters>
</asp:ObjectDataSource>

Can you tell me what it really means and how to fix it?
This usually means that the control you are trying to reference is inside a
template field of a data control (gridview? repeater?) or otherwise not
directly accessible from wherever you have your code-behind. You need to
use the FindControl method to get to it:

BulletedList blist = (BulletedList)<DataControl>.FindControl("blMessage s");

<DataControlis the name of the housing control - GridView1 or whatever you
have called it.

HTH

Mike
Jan 9 '07 #2
Hi Andrew,

As for the ASP.NET web page, can you directly run it(view in the browser)
without compiling the entire website? I've found some other threads
discussing on this issue. It seems such behavior is likely due to the
status of that page in the project be corrupted. From those threads, you
can try the following things to see whether it works:

1. exclude the problem page from the project and close the VS IDE.
Reopen the solution/project and include the page again.

2. create a new page and copy all the markup and controls from the problem
page to the new page. remove the old problem page and compile the site
again.

Here is a thread on MSDN forum discussing on this:

http://forums.microsoft.com/MSDN/Sho...00532&SiteID=1

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Jan 10 '07 #3

"Mike" <xx*@xxx.xxxwrote in message
news:u3**************@TK2MSFTNGP04.phx.gbl...
>
"J055" <j0**@newsgroups.nospamwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>Hi

I'm using VS2005. I get the above error when trying to build the
solution. Intellisense is OK.

// Code behind
protected void odsPublication_Inserted(object sender,
ObjectDataSourceStatusEventArgs e)
{
if (e.Exception == null)
{
blMessages.Visible = false;
}
}

//This is the webcontrol and ObjectDataSource

<asp:BulletedList ID="blMessages" runat="server" ForeColor="Red"
Visible="False">
</asp:BulletedList>
<asp:ObjectDataSource ID="odsPublication" runat="server"
InsertMethod="AddPublication"
OnInserted="odsPublication_Inserted">
<SelectParameters>
...

</SelectParameters>
<InsertParameters>
...
</InsertParameters>
</asp:ObjectDataSource>

Can you tell me what it really means and how to fix it?

This usually means that the control you are trying to reference is inside
a template field of a data control (gridview? repeater?) or otherwise not
directly accessible from wherever you have your code-behind. You need to
use the FindControl method to get to it:

BulletedList blist =
(BulletedList)<DataControl>.FindControl("blMessage s");

<DataControlis the name of the housing control - GridView1 or whatever
you have called it.
Oops. Missed the bit about Intellisense in your OP.
Jan 10 '07 #4

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

Similar topics

11
by: Andrew Thompson | last post by:
I have written a few scripts to parse the URL arguments and either list them or allow access to the value of any parameter by name. <http://www.physci.org/test/003url/index.html>...
6
by: CuriousGeorge | last post by:
I've upgraded a .Net 1.1 web app to 2.0 and am having a heck of a time getting resources to work again. From what I understand if I move my strings.resx file into the App_GlobalResources folder I...
1
by: Arjen | last post by:
Hi, I do this inside a repeater: <% if ((Boolean)((DataRowView)Container.DataItem) == true) { %> <%} %> I get this message: CS0103: The name 'Container' does not exist in the current...
3
by: Michael | last post by:
Hi, I am getting a strange error. Last night when I left work this was working perfectly. This morning when I try to run this code in VS2005, it comes up with an error saying "The name 'UserName'...
4
by: techguy78 | last post by:
Hi - I added a gridview to me aspx page and i 'm trying to assing data to it from codebehind. i'm getting this error.. The name 'Gridview1' does not exist in the current context Any idea...
2
by: weird0 | last post by:
When i am working on client side of a webservice, where i add a reference to it(have written the function CheckPincode inside the webservice), the compiler says: the name CheckPincode does not...
5
by: nudrat | last post by:
I included a control TextBox with 'txtError' name. whenever I build this I get this error. The name 'txtError' does not exist in the current context But its running on last successful Build. I...
1
by: avecreep | last post by:
Hi, i was trying to find a web application and i found one open source on the internet. i put the code folders on the root folder and when i tried to acces via web browser it all worked fine ( i...
0
by: Terry | last post by:
Hello, I have problem adding controls to my webpage default.aspx. There is a group of controls that just refuse to be used with message: 'The name 'controlname' does not exist in the current...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.