webforms

Best way to globally set every control's ValidationGroup property in an asp.net?

I have a User Control with form items that is re-used considerably throughout a large web application, and up until this point the validation summary upon an invalid form submission is being handled by the .aspx that consumes the User Control. Now I need to set the ValidationGroup property at runtime for each of my form items controls (...

Check for script in asp.net text box

We would like to stop users inputing html or javascript in a text box. We can just parse the input and check for angel brackets. Was wondering is there a better way to do this? ...

Urlrewriting.net pages are not causing postbacks

I'm using webforms with UrlRewriting.Net to rewrite pages, e.g. http://www.example.com/stuff.aspx?c=30 becomes http://www.example.com/stuff/30-this-stuff.aspx. It works in so far as the correct content is loading; however, none of the postbacks are working (mostly buttons on the page). If I set up a breakpoint on Page_Load, I...

ASP.NET Web Forms: Is it smart to call a custom "Bind" method in a user control's property's setter?

I haven't touched ASP.NET Web Forms in years and I'm a bit rusty with it. I currently have a user control which has a list of editable articles, this user control contains another user control (EditArticle.ascx), which is not visible on load. EditArticle has a property called Article which reflects the article one could edit. However ...

strategies / patterns for handling complex web crud forms?

using classic asp, over the years we have developed a framework to handle some fairly complex web crud pages. the crud class is designed as some kind of "finite-state machine" the state is preserved between posts using hidden fields, and every event on the pages raises a post with a certain action. according to the action triggered, an...

c# Form submit viewstate error

Hi! Im trying to setup a login functionallity in C#, where I have a form on default.aspx that posts to Login.aspx where the logic is runned. But when the form posts to Login.aspx I get a MAC viewstate verification error. What is this and why? When I call Login.aspx direct from the browser I get no error, only when the form posts itse...

How to disable a ASP:Panel but except selective child control?

I have a asp:panel on the root and a lot of controls inside. When I disable the panel, all child are disbled (Panel.Enabled=false). But I want some of them, e.g. hyperlink, keep enabled even if the container is disabled. If I cannot do this in a smarter way, I will have to break down my Panel into many pieces to make it works. EDIT:...

WebForms: DetailsView uploading an image (to a new record)

I'm trying to upload an image in situe using a DetailsView but I need to store the filename when I commit to the DB. Here's what I've got so far: protected void UploadProductImage(object sender, EventArgs args) { if (HttpContext.Current.Request.Files.Count > 0) { //Grab uploaded file HttpP...

Asp.Net WebForm JQuery remote Validation

I want to do exactly the same thing that in this question : http://stackoverflow.com/questions/1249709/jquery-validation-remote-validation-not-working The only thing that change is that I'm using Asp.Net WebForm instead of Asp.Net MVC. So, the solution proposed in this post doesn't work for me... UPDATE From Jeff comment, here's my ne...

Different Connection Strings with Entity Framework based on Context

I have a web forms application that uses entity framework, the application is deployed on a development box, my local machine and a production box. Each of these have different connection strings. What is the best way of handling this. I use TFS Build Server to deploy to development and take the result of that build zip it and copy it t...

What is the purpose of precompiledApp.config?

If you precompile a web site and keep it updatable, the ASP.NET parser can see from the Page directive that there is no codefile or codebehind and where to find the base class (inherits attribute). <%@ page language="C#" autoeventwireup="true" inherits="_Default, Precompiled" theme="Default" validaterequest="false" %> If the site is pr...

C# WebClient Log onto Website

Hello, I'm trying to log onto a website by providing my (correct) username and password. Here's the code: string URL = @"https://www.t-mobile.co.uk/service/your-account/login/"; string username = "a_user"; string password = "a_password"; //ServicePointManager.Expect100Continue = false; CookieAw...

Problem using form runat=server with master pages?

I have a master page with two ContentPlaceHolders. I have a default page.aspx which uses this master page. In the default page one ContentHolder has a TreeView and the other has a GridView. Now i need to display both of them together and both require <form runat="server">. But the issue is that i cant have two instances of <form runa...

How to tell if a refresh came from a Timer (C#)

I have a ton of update panels and such on my webform (which are created dynamically at runtime) I am wanting to put a locking timer or something similar in my form also. My problem is this. When someone is typing into a text box, and the timer happens they lose part of their text and the control loses focus. The reason this happens is...

How do I eliminate these order dependencies from my code

In ASP.Net Web Forms there are cases that I've come across that create order dependent code. As an obvious code smell I'm looking for solutions to solve this problem. A pseudo-code example would be: Calling Code :: Page.aspx protected void Page_Load(...) { var control = LoadControl("ControlX.ascx"); // Ugly since the control...

Visual Studio Web Project Statistics

I'm looking for something that can spit out statistics on Visual Studio 2008 web projects, both Forms and MVC. Things like: Number of pages per project Number of user controls Number of classes Number of methods Number of images/CSS File creation dates If the information exists already in Visual Studio, I can't find it. I've also tr...

Single overloaded method at BLL layer vs BLL methods having one-to-one correspondence with DAL methods

Hi Assume we create 3-tier module, which enables us to display/create/edit articles. Articles are: • organized into categories • before article can be published, admin has to approve it by setting Approve field of Articles DB table to true • by setting MembersOnly field ( Articles table ) admin can also specify whether particular ...

Non-traditional input using CSS sprites and JavaScript: opinions sought.

My client is very invested in using a bunch of non-traditional inputs in a form we are developing for him. The image below represents various states of the interface with the last indicated it is disabled in the current context. The end users will be trained in how to interact with the inputs. My idea is that we will develop an imag...

The right way to do radio buttons?

So.. I have been trying to avoid radio buttons at all cost in my web development projects because I just cant figure out the right way to code them. Do you set a label for radio button.. if so, how does that work for screen readers. The way I have been doing most of my forms is by using un-ordered lists. Each input being a list item. ...

how am I supposed to find out that a form is being submitted twice?

Is something in the http protocol that will help me find out, or should I check the fields by myself. If identical field values can be submitted more than once, should I add a dummy hidden field or something? ...