Okay so my situation at work is that I've written about 200 or so lines of additional functionality into an aspx page's code-behind that is currently not to be implemented. It is in a subroutine that handles an event that currently has zero chance of occurring.
Because this code is not being used, I've gotten curious. Should I comment out the subroutine that has zero chance of firing? Would it do anything to enhance the performance of the page or anything like that if I did indeed comment it out? Or could/should I just leave it as is?
Im having problems passing a variable from my c# code behind into my asp as part of a connection string. how do i go about passing in a variable from my code behind into my asp.
I have a question, I am writing a user tracking class that needs to obtain the screen resolution of the user. I have the javascript all written and it is working along with a hidden variable ( used to set the javascript vars so I can access them server side ). What I am running into is when I try to access the value of the hidden variable on Page load it's not there, but If I cause a post back I can get it. How can I access this data on page load? There is no guarantee that the user will ever cause a postback, some users just look at the home page and leave.
I have a Master Page which controls the styling of my site. In the Code Behind, there are a few class instances instantiated as well as variables. These classes validate user access and then create user objects
I have a few Web Content Forms which carries out instructions based on the user objects. So far it seems that on each Web Content Form I have to create new instances of the classes found on the Master Page. This is doubling my work for every Web Content Form.
Is there anyway I can inhereit Classes and objects instantiated in the Master Page Code Behind?
I have a webpage in which I declared a variable in my code-behind as:
Code : Private ok As New HiddenField
I have a javascript function that sets this variable to either "T" or "F". However, I have a server-side button control that in the click() event, it checks the "ok" variable like this:
Code: If ok.Value = "T" Then FormatFields() End If
The javascript function initializes the "ok" variable to "T". It goes thru a series of field edits. When a field doesn't pass the edit, it sets the "ok" variable to "F". Either way, this variable has a value. When the code-behind event above checks the "ok" variable, it's value is "".
I have this code in javascript: var x = e.mapX; It gets the X-coordinate of a map. What I want to do is that I want to store this into a c# variable. I have a class named Test with an integer property X. I want to store var x into X. In the codebehind, I have this on the Page_Load: Test test = new Test(); Then I am trying this on the javascript code: var x = e.mapX;
I use asp.net (webforms flavour) for the server coding. Let's say that I stored a variable called "test" inside the Session object.Is there a way to grab its content inside the javascript js file (I use Jquery). Currently, I use the following workaround - in my aspx.cs file I populate a hidden field, then in Jquery I grab the contents of that field.What is the proper way to do that?I tried to expose the session through a web method and using $ajax function to get the value on the Jquery side, but I am getting security error - "permission denied" - no additional explanation offered.My workaround works fine, but to me it seems rather clunky. What are the common ways to achieve session access in Jquery?
While working through some demos today I managed to trick VS 2008 somehow and I cannot access any server side events or variables in the code editor window. Hopefully
this screenshot will demonstrate exactly what I am missing. No matter what control I pick from my source I get the same drop down items overhead. What is quite weird is that when I drop new server side controls onto the source editor I can set the tag attributes for the events, but when I double click that event there is not an automatic created event handler with the same name created for me. Also, on the property pages there is no events image button (the one with the lightning bolt). The only property page items which have the events image button (lightning bolt) are the ajax toolkit controls. Already tried the "import all settings - VB Default" to blast away everything and no luck..
I'm trying to set session variables in one page, and retrieve them in my code file in the page that it posts to.
I keep getting this error. I put the correct namespaces in, and enabledSessionState = true to my application files, but no luck.
Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration><system.web><httpModules> section in the application configuration.
I'm just calling a session variable, and I get that error
e.g,
Public AUID As Integer = Convert.ToInt16(Session("AUID"))
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?
suppose our model has a property named "CreatedByUserId" that keeps the creator's user id
when we want to update our model, there are no need to display this field, but we should keep it's value during the update.
so, if i don't place any edit field for this property on the view, the model wouldn't have any value for CreatedByUserId property when returns to controller
to solve this, i :
1.place a hidden input in the view for these fields (which is vulnerable)
or
2.make a Get call to db and get the original CreatedByUserId value on each update (which causes additional round trips to db)
In a webapplication we have a lot of images and some of them are not used/referenced anymore. Is there way (tool or something) to get a list of all these unused files or/and delete them?
i am working on asp.net application using C#, identifying properties that are unused in my project. in Code analysis tool i am able to see unused private fields getting reported (Avoid unused private fields), but is there any such facility too for unused Properties declared in the class.
I need functionality that will allow to discard objects from session if they are not used in specified amount of time. It is simmilar to Cache timeout functionality.
Is there any session provider (possibly free) or pattern that achieves that?
i am trying to collect 2 variables from one hyperlink, and use those variables in the page_load to set as session. but i don't know how to collect those 2 variables
i would like to collect '#FF0000','#FFE4E1' or direct set '#FF0000','#FFE4E1' to string then send to pageload, how can i do this by only clicking on it ?
Inspecting om my PLESK 8.2 on APACHE2 with PHP 5.2.3 I saw this. Being a person who loves peed, would I gain anything by disabling all the stuff except PHP? which is the only thing I use really? I'll do anything to speed up my site.
whats the exact use of static variables in overall programming in .net and for asp.net...
Recently i went for the interview where interviewer asked me 2 question which i was not sure for the same..
whats the use of session object, i said sessions are the server side object, they are used when you want to store user specific data at server side, then he asked what if i want to use static variables for the same, i was mum, can anyone tell me how asp.net will behave if i store the user specific information in static variables.If i use cookies which are the best option to store the data at client side (not sensitive one), but what if user has disabled cookies on his machine, will my application would crash.