I want to retain a variable between postbacks, so I write an accessor to put it into viewstate. Which one of these is the best way to access it? Or is there a better option?
Option 1:
private int Status
{
get
{
try
{
return (int)ViewState[@"__Status"];
}
catch
{
return 0;
}
}
se...
hey again stackoverflowers
I'm migrating a website from old ASP (in VBScript) and there's certain stuuf I have to iFrame as to keep the old stuff working inside a new container.
on the aspx page I have an iFrame with the runat="server" attribute to make it available in the code behind file.
<iframe id="frmLoader" runat="server" scrol...
I am looking to create a blog and a forum on a new website. I would like for users to register to post in the forums and post comments on the blog as well as having thier own public profile page.
I have experience with BlogEngine.NET so was looking to use that. I have no experience with .NET forum software at this time so I am researchi...
I'm trying to get client-side validation running. I've put together a very simple test - file name is aTET3.aspx:
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="aTET3.aspx.cs" Inherits="aTET3" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
...
Background
I have created ASMX web services in the past and have been able to access the service from the web browser and Ajax GET requests using the address convention: MyService.asmx/MyMethod?Param=xxx
I just got started using WCF and created a new web service in my ASP.NET project. It creates a file with the .svc extension such as My...
I want to set my FormsAuthentication cookie to timeout BUT VIA CODE. I know I can do this in the web.config but I want to configure at the database. Is this possible via code?
<system.web>
<authentication mode="Forms">
<forms timeout="50000000"/>
</authentication>
</system.web>
...
I have an ASP.NET 3.5 page with some AJAX, some Validators and some business-rule validation done in the code-behind page (VB.NET).
The Validators set focus to the 'offending' control when an error is detected.
When a business rule is violated, I used the following code to generate some javascript "on the fly" and execute it to simul...
Currently, in all of our environments we have healthmonitoring turned on to alert us when ever a user has caused an error:
<healthMonitoring enabled="true">
<providers>
<add name="MailWebEventProvider" type="System.Web.Management.SimpleMailWebEventProvider" to="[email protected]" from="[email protected]" buffer="false" subjectPrefix="pr...
Is it possible to perform a postback and have the viewstate remember the selected value on the following code?
It seems placeholder1.controls.clear() is deleting it.
protected void Page_Load(object sender, EventArgs e)
{
bind();
}
protected void bind()
{
PlaceHolder1.Controls.Clear();
DropDownList ddl = new DropDo...
I am a developer and am trying to create a very basic "Hello World" .NET 3.5 web app. However, whenever I publish the code I am getting the following error.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify y...
This is actually a follow up on my previous question (link)
I've created the HttpHandler and it works fine for now, I'll add flexibility by using the querystring and session to point the post I'm making in the right direction.
The next question is as follows.
Now that I have the old page iframed as it should be, there's still the trou...
Hi,
I know there is already another post on StackOverflow (here) but it doesn't exactly address my issue.
I would like to use the HTML button element () on ASP.net wherefore I've created a custom server control for rendering such. The reason for using a button is mainly to be able to create an image button. You could now argue to use CS...
We're looking at using HTTPS in our ASP.NET webforms application for a shopping cart section. I have read somewhere that we will need to write code to check if the users' browser/device has encryption to avoid it falling over?
Is this the case, if so can you point me in the direction of what sort of namespaces/blogs etc I should be loo...
I was reading the ASP.Net vs Silverlight (Reach vs Rich) and need a clarification, if the requirement is to force everyone going to use my app is to download silverlight, then performance and security wise, silver light is better solution than ASp.Net (also avoiding activx controls for developing rich grids)?
I am doing all the developm...
I am tryng to loop through an xml doc and I am still getting the first element in the second iteration, not sure what I am missing. Can anyone help? Pretty new with Xpath
string file = HttpContext.Current.Server.MapPath("~/XML/Locations.xml");
Dictionary<string, Location> locationCollection = new Dictionary<string, Location>();
...
In one of the rows of a details view control I want to be able to chose what control is to be rendered on edit mode. Basically I have to render a checkbox in one situation, while in another I have to render a text box. Other rows are How can I achieve this, I am a beginner so links and code snippets would be very helpful?
...
Hello,
I'm writing a custom user control for my asp.net site, for storing datetimes. It has two properties:
Private _includeTime As Boolean
Private _value As DateTime = Nothing
Public Property IncludeTime() As Boolean
Get
Return _includeTime
End Get
Set(ByVal value As Boolean)
...
I'm working on a site that uses Google Analytics. On most of the pages the default call to _trackPageView() that records the page view in GA using the current URL works just fine. I can add that code to a master page so it is included on each page.
However, under certain circumstances I want to override the name of the page that get...
I need to perform some events (sending emails, etc.) based on time. What is the best way to accomplish this in ASP.net in a hosted (medium trust) environment?
ex: Send email every day at 4:00pm.
ex: Send email after 15min of login.
ex: Send email after 10 hrs of last change to status.
The triggering logic can be complex on some of ...
I am trying to bind an ASP.NET GridView control to an string array and I get the following item:
A field or property with the name
'Item' was not found on the selected
data source.
What is correct value I should use for DataField property of the asp:BoundField column in my GridView control. Here is my source code:
ASPX page
...