I have a class TicketOrder. It's not recognizing my lstSectionNumber (Tickets.TicketForm.lastSectionNumber is inaccessible due to its protection level).
Here is the code for TicketOrder class:
public class TicketOrder
{
public TicketOrder(TicketForm form)
{
this.form = form;
}
//Declare static variables
[Code] .....
This is my code behind:
public partial class TicketForm : System.Web.UI.Page
{
//Declare variables
int myInt;
TicketUser user = new TicketUser();
TicketOrder order;
I've got a class that create a report in a PDF - looks like this
Code: Option Explicit On Imports PdfSharp Imports PdfSharp.Drawing Imports PdfSharp.Pdf Imports System.Data.SqlClient Public Class acsReportWriter
[Code] ...
And I access this class from within a web service call like this
Code: Using acsRpt As New ACSReport.acsReportWriter acsRpt.StartDocument(strViewName, strTitle, username) Using dcn As New SqlConnection(connStr) Using cmd As New SqlCommand cmd.CommandType = CommandType.StoredProcedure
[Code] ....
So - in that web service I can access APPLICATION like this
Code: With Application .Lock() ' need to do work here .UnLock() End With
I need to be able to access APPLICATION from the acsReportWriter class to put status message every so often so another AJAX POST can fid out how many pages are done.
I'm having a hard time even adding IMPORTS to SYSTEM.WEB in the acsReportWriter class
i have a data grid view that i roll over and generate a tab delimited file out of using the reponse object in ASP. to wit...
Code: protected void CreateTabFile() { var d = DateTime.Today.ToShortDateString(); d = d.Replace("/", ""); var filename = "BankRecon"; filename += d; Response.Clear(); Response.Buffer = true
[code]....
how do i set it up to save the file to the datastore folder i have on the site itself, i want to automate an email and send this as an attachment, the email part works, but if its not in a consistent place i cant attach it. its an asp.net webforms project not a website project.
Why doesn´t this property return a datetime formated with the following pattern when using the property in the codebehind page in my ASP.NET Webforms website? When debugging i can see that the value the returning datetime is "2011-02-21 16:13:29.670" wich is correct.
[code]....
And after assigning the returned property value to a hiddenfield in the .aspx page i get this value assign to the hiddenfield.value "2011-02-21 16:13:29"
I've scenario where I want to insert data into database without post back. there are around 12 to 13 fields which i need to insert. I'm passing DTO from the client side which is actually Json object. Now the problem which i'm facing is how to convert that Json object which i got in webservice to the "class" (in my case class name is User) object.
[Code]....
In the above case AddNewUser method takes the object of User class. But i'm getting casting error. So how do I convert Json object to the "User" class object?
I've got an entity that inherits from another, but for some reason the entity that is inheriting isn't showing as an available object? The parent entity is "Customer" and the child entity is called "RetailCustomer", but only "Customer" will show in intellisense as being available? I'm currently using:
[Code]....
And really need to be using something like this...
[Code]....
but VS comes back telling me that RetailCustomers isn't a member of my Entities Context.
I have an existing class for an input, is it possible to add an additional class for the object in C#.net, instead of doing a if/else and not having a preset class on the object in the first place?
I am generating an Excel file upon a click of a button in an update panel. It is throwing a parsing error.
If I keep the button outside the update panel it is working fine. Why isn't it working in the update Panel?
Response.ContentType = "application/vnd.ms-excel" Response.AddHeader("Content-Disposition", String.Format("attachment;filename={0}", filename)) Response.Clear() Response.BinaryWrite(WriteToStream.GetBuffer) HttpContext.Current.ApplicationInstance.CompleteRequest() Private Function WriteToStream() As MemoryStream 'Write the stream data of workbook to the root directory Dim file As MemoryStream = New MemoryStream hssfworkbook.Write(file) Return file End Function
When I get an Object Ref error, it can sometimes be a real pain to find out which variable is causing the error (when you can't debug). Is there a way for this error to throw the classname that isn't assigned?
We have a web project that contain its business methods in a class library project called "Bll.dll" some methods of Bll.dll return List<> ... from a source - that i don't remember now - told that returning Collection<> is better than returning List<> Is it a valid ? Note that i don't make any process on values returned from BLL methods .. just view it in a web page
i have 10 classes and i want to send the class in a paramenter dynamically to call a method for example int addmember(aslogic.base obj) smilary i want to pass class in the parameter.
My problem today is that I am having trouble shifting some functionality, that is being used in multiple applications, from the applications themselves to a class library I have started building. The issue comes in the fact the code was written to utilize Response objects as seen below...
[Code]....
This is all currently within a function called "DownloadDocument". I continue to have issues running any of the Response object functionality. I usually get the error saying, "Response is not available in this context", is there anyway to use a Response object in a class library file?
Why do we use the reference of abstract class (or base class) to create object of it's sub-class. eg: TextWriter is the abstract class for StreamWriter & StreamWriter.
I am interested to know what happens with unused properties of a class when an object is instantiated?
Are there performance hits for having additional unused properties? What about complex properties that are accessing the database, but I'm not using them, are they still being loaded?
I have a user control with a number of methods. I also have a dataset object that I'm filling in one method, but I also need to access that same dataset (and the data in it) in another.
I am filling the dataset from some xml that I get from a webservice when someone clicks on a button. The data from the dataset is then bound to a listbox control. When someone selects an item in the list control (I have autopostback set to true on it) it then fires off another method and it's this method where I need to access the data in the dataset, but when I check the immediate window it's telling me that the dataset is set to null.
When I create a report in my Visual Studio 2010 (SP1 Beta) Web Site and select New->DataSet ... from the Report Data window, the DataSource Configuration Wizard goes directly to 'Choose You Data Connection'.
In the desktop world the wizard first presents the 'Choose Your Data Source Type' wizard screen where I can select 'Object' as the type. In my case it skips this screen and goes directly to the 'Choose You Data Connection' wizard screen as if I had clicked 'DataBase' as my type. Note that I do have 'LINQ to SQL Classes' in my project.
I have reviewed the following link but it does not seem to in my case and I am using dbml rather than xsd:
I have a page, Default.aspx, with its own code-behind file like this:
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { public int[] anArray; }
What I'd like to do is access to "anArray" from a C# class (not tied to a page) declared in App_Code folder. What can I do?
Edit: As said in the first comment, I really apreciate your about refactoring my connection objects. However, what I'm really doing here is to rewrite an old PHP application in order to get comfortable with basic C# and ASP.NET, so this code will never go really live. So, I'm still intersted in a way (if any) to access an object declared in a code-behind code from a standard C# class.
Edit2: I removed the OdbcConnection object in order to focus to the real problem: how to refer to an object istantiated in a code-behind file from a C# class situated in App_Code?