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

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
homeshopperAsked:
Who is Participating?
 
chinawalConnect With a Mentor Commented:
I think,  Session("InsertFlag") should be Session["InsertFlag"]
0
 
homeshopperAuthor Commented:
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
 
homeshopperAuthor Commented:
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
 
declanmcdConnect With a Mentor Commented:
When converting from VB to C# the DataItem format is

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

In C#: <%#((DataRowView)Container.DataItem)["FieldName"] %>
0
 
homeshopperAuthor Commented:
yes or course.
Thanks for all the help.
0
All Courses

From novice to tech pro — start learning today.