Solved

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

Posted on 2010-08-13
5
3,347 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 250 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 250 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASP.NET Built-In Report Creator / Viewer 5 39
Calculating percentage 2 46
Web page design problem 3 39
Fastest way to get file count in MS Server 2012 3 34
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
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.…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

738 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