Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2010-08-13
5
Medium Priority
?
3,560 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 1000 total points
ID: 33432300
I think,  Session("InsertFlag") should be Session["InsertFlag"]
0
 

Author Comment

by:homeshopper
ID: 33432632
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
ID: 33433206
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 1000 total points
ID: 33433386
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
ID: 33433526
yes or course.
Thanks for all the help.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

927 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