Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 582011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:38:28+00:00 2026-05-13T14:38:28+00:00

I am creating an object at server side of an aspx (test.cs) page from

  • 0

I am creating an object at server side of an aspx (test.cs) page from a class (asp.net 2.0 C#)

public partial class Vendor_VendorUsedTicketsPopup : System.Web.UI.Page
{
    ReportInvoice _objReportInvoice = new ReportInvoice();

    protected void Page_Load(object sender, EventArgs e)
    {
        _objReportInvoice.ReportId = 1;
    }
}

as you see above before Page Load I am creating a new ReportInvoice object and on page load I am setting property ReportId to 1

On test.aspx I want to use the ReportId value bu using the _objReportInvoice object like below

<div><% _objReportInvoice.ReportId; %></div>

But when I build the site I get the error
The name ‘_objReport’ does not exist in the current context

I know that I can create a public integer for ReportId above Page_Load and use it on aspx page. That works fine , but I want to use class object properties on aspx page.

What is the way of doing sth like that ?

Thanks…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:38:28+00:00Added an answer on May 13, 2026 at 2:38 pm

    You need a = sign in there to print it to the page:

    <div><%= _objReportInvoice.ReportId; %></div>
    

    However, I would suggest just using a Literal or Label control there and then setting it’s text to the ReportID property in the code behind. Inline code like that can make your HTML messy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to call ASP.Net server side code from the client. Because I'm in
Does creating an object using reflection rather than calling the class constructor result in
Hello can anybody solve this please I'm creating the object in the action class
im creating a Factory class that will contruct and return an object. I normally
I'm creating the server side implementation of an AJAX based web application, where the
I am dynamically creating forms from a JSON object that I fetch with a
I'm creating registration page and I've done basic client side (JS) form validation. Now
I'm creating a Page object and adding a control to it for printing purposes.
I am creating object-detection program on Mac. I want to use iSight in manual
I did it by creating OLE object with Delphi in 2000/NT/XP as following: Voice

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.