?
Solved

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

Posted on 2010-08-13
5
Medium Priority
?
3,442 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month13 days, 7 hours left to enroll

800 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