Solved

Non-invocable member 'System.Web.UI.Page.Session' cannot be used like a method

Posted on 2010-08-13
5
3,208 Views
Last Modified: 2012-05-10
I have been converting code from vb.net to c#.net & get the following compile error:
Non-invocable member 'System.Web.UI.Page.Session' cannot be used like a method.
C:\Projects\camsCSDev\camsCSData\Schema_Alt.aspx.cs: Line:95:Column:65
if (System.Convert.ToInt32((int)(new Page().Session("InsertFlag"))) == 1)
I have attached complete code .aspx & .aspx.cs files for clarity.
Thanks in advance for any help.
Schema-Alt.txt
0
Comment
Question by:homeshopper
  • 3
5 Comments
 
LVL 5

Accepted Solution

by:
chinawal earned 250 total points
Comment Utility
I think,  Session("InsertFlag") should be Session["InsertFlag"]
0
 

Author Comment

by:homeshopper
Comment Utility
Thanks it works.
I used to do a fair amount in C#, but have resently been doing vb.net a lot.
Must be getting a bit rusty on C#.
0
 

Author Comment

by:homeshopper
Comment Utility
I am getting same error on another page with similar coding, but a master file.
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="DefaultPage.master.cs" Inherits="DefaultPage" %>
Non-invocable member 'System.Web.UI.WebControls.RepeaterItem.DataItem' cannot be used like a method.C:\Projects\camsCSDev\camsCSData\DefaultPage.master
I am attaching complete file for clarity.
Thanks in Advance.

DefaultPageMaster.txt
0
 
LVL 3

Assisted Solution

by:declanmcd
declanmcd earned 250 total points
Comment Utility
When converting from VB to C# the DataItem format is

In VB: <%#Container.DataItem("FieldName")%>

In C#: <%#((DataRowView)Container.DataItem)["FieldName"] %>
0
 

Author Comment

by:homeshopper
Comment Utility
yes or course.
Thanks for all the help.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now