I have no problem accessing these variables form .ascx.cs or .aspx.cs file -- ie. files that are part of the Web content. However, I can't seem to access 'Application' from basic class objects (ie. standalone .cs files). I read somewhere to use a slight variations in .cs files, as follows, but it always comes throws an exception when in use:
I first need to apologize in case this has been answered before but I'm a newbie (green as they come) and this error keeps popping up even before I start debugging! There are two errors and the second one is:" Error 2
Missing partial modifier on declaration of type 'WFPKenya2.WFPKenya2'; another partial declaration of this type exists"
Suppose we declare and define the variable in one class let say FirstClass and we want to use that variable in another class let say SecondClass which is outside of FirstClass .how to do this?
I want to assign array of photos to imagearray but the following script is not working. i cant able to access variables a,i,cnlink etc in new fadeSlideShow() .how to access this outside the function and assign it to imagearray
<script type="text/javascript"> var i; var a; var cnLink; var cn;var cnSplit; var photos = new Array(); var photoslink = new Array(); function x() { a = document.getElementById('HiddenField4').value; cnLink = document.getElementById('hdnLink').value; cn = document.getElementById('HiddenField3').value; cnSplit = cnLink.split(';'); while (i < cn) { photoslink[i] = cnSplit[i]; photos[i] = b[i]; i++; } } var mygallery2 = new fadeSlideShow({ wrapperid: "fadeshow2", dimensions: [568, 313], imagearray: [ photos //<--array of images! ], displaymode: { type: 'auto', pause: 2500, cycles: 0, wraparound: false }, persist: false, //remember last viewed slide and recall within same session? fadeduration: 500, //transition duration (milliseconds) descreveal: "always", togglerid: "fadeshow2toggler" }) </script>
I am working on an asp.net mvc app.Right now I am looking for the best solution to access session variables. Is it oke to make a static class to get session variables, like:
[Code]....
And so on for other session variables.Is it allowed to access session variables in static model classes ?
I am tasked with customizing a third-party web application. Since the application is updated (ie new files are copied over the existing files) several times a year, I was hoping that I could put my custom code in separate files -- sort of like having asecond code-behind file for each page that is modified.
I have a website that i converted from asp .net 1.1 to 2.0 and now i have one page that said ambiguous reference because in 1.1.all controls needed to be defined in the class as well. Well after deleting those and leaving only the declares in the Markup,it says that the variables do not exists in current context. Intellisense allows me to use and reference them from the page but when trying to build it leaves me with that error.
I requirement is my code Behind file contains more than 5 thousand line, Now i want to split the code into two file ...The other file also accept the web controls eventsi tried with partial classThis is my Code Behind File
How can I retain the value of variables that I fill from CodeBehind throughout the session? (C#). For example, I do a LINQ query from the log in "on-Click" button event. The query produces a bunch of data about the user that I want to access throughout the session on additional ASP pages. I know that I can pass a large query string but I suspect that there is a better way. Here's a specific...
from the db function I product: COS=2 (class of service). Throughout the session, I test for COS and display appropriate pages. Assume that the LINQ query is accomplished in the CodeBehind attached to the "loginButton" within the "login.aspx" page.
I have some code I only want to execute the first time I display a form. With this in mind I created a class variable which I initialize the first time I execute page load.
public partial class CLVideoDefinition : System.Web.UI.Page { string videofile; string first; protected void Page_Load(object sender, EventArgs e) { if (first != "N") {
I then select a value from a drop down list , but when it does the auto postback it executes page load but my class varaible has been reinitialized to null and will then execute the code I only want to execute on the first run. why my class variable has been reinitialized.
I have a code behind page with two functions that return two counts (iCount and iCount2). In my repeater table I can display the results of the functions just fine, but now I need to do some conditional logic based on the results of the functions, eg:If iCount =>3 AND iCount2 =>1 Then
I hope I am posting into the right area... I want to know if you can access a session variable from a HTTP Module in IIS 7. Here is the scenario, I want to access the session values (i.e. User Object) from a HTTP Module. I have read oodles and tried many things but to no avail. I guess the application uses Forms authentication to authorize a logon to the site. I want to monitor the url that is submitted... RAWUrl property and if they are going to a certain page I want to grab their user object from THEIR session and validate them for access to that page. I want to use a httpmodule for this. The long and short of this is "Can I get access to session variables from the request from the httpmodule code behind? If I can, could you beso kind as to show me a working sample... I have tried many permutations on this using httpapplication, context and so forth and I can't seem to get access to session variables that would belong to the users request. it this possible?
I need to be able to access simple page controls like a textbox from my page class. So if I have a simple aspx page with a textbox on it, I'm trying to do something like this. i'm not using codebehind btw:
[Code]....
I thought maybe I could pass a reference to the page into the class, something like:
[Code]....
But that's not working either. How can I access page controls from my class?
I have several .aspx pages that all have identical code behind pages.For ease of maintenance,I would like all the aspx pages to share a common code behind page. To do this I have created a MyCommonClass class,which contains the common code.In the code behind of the .aspx pages, I have:
Partial class MyPage Inherits MyCommonClass End Class
But now the controls declared in the .aspx pages are not accessible in MyCommonClass.fix this?
I'm face of a little problem when using GridView, an EntityDatasource and entity custom properties using a partial class. I'll describe it and I hope that someone has already find the solution because I try to figured out since two days.
i have to write this piece of code in almost 10 to 15 content pages. i am just wondering if i can class file as base class for my content pages and write this piece of code in that class.
[Code]....
can somebody guide me how to write the base class for this scenario?
I have an issue with trying to create a Pdf file from my webpage. Basically, everythig involving creating the Pdf (using iTextSharp) is done, and I'm doing this as a File Stream (i.e, I'm saving the Pdf on local machine). Now what I'm trying to do is create it as a Memory Stream (i.e, open the Pdf from the browser). I was able to do this earlier when I wa still at the 1st version of the application, and all of the code behind was incluced in my .aspx.cs file. But now, I've kept the code in the .aspx.cs at a minimum and put the cude in classes and I'm creating onjects of thoses classes from the .aspx.cs
The problem is that the code from creating the Memory Stream is in a class as follows:
[Code]....
As you can imagine, the compiler cannot recognise "Response" as it's in a seperate class instead of in .aspx.cs
I am maintaining and old application in ASP.Net and it has one CustomGridView control with 4000 lines of code. I see that in that file only, when I try to modify any code the IDE does not respond quickly as it does for other files. I thought of creating partial classes for the same but it seems that VS is not reconginzing the new partial class. I am trying to use the variables from the old partial class and it is not able to reconize any variable or method.