webforms

Remove the bar at the top of Loginview for formatting

I'm making a webform using a loginview, the problem is that because the control includes a grey bar telling you what type of control it is it throws of correctly formatting the page (It has LoginView1 at the top), is there a way to hide this on the LoginView as the contentPlaceholder does an excellent job for this. I've found that you c...

Calling base Methods When Overriding Page Level Events

In my code behind I wire up my events like so: protected override void OnInit(EventArgs e) { base.OnInit(e); btnUpdateUser.Click += btnUpateUserClick; } I've done it this way because that's what I've seen in examples. Does the base.OnInit() method need to be called? Will it be implicitly be called? Is it better to call it at t...

Creating a UserControl Programmaticly within a repeater?

I have a a repeater that is bound to some data. I bind to the ItemDataBound event, and I am attempting to programmaticly create a UserControl: In a nutshell: void rptrTaskList_ItemDataBound(object sender, RepeaterItemEventArgs e) { CCTask task = (CCTask)e.Item.DataItem; if (task is ExecTask) { ExecTaskControl foo ...

How to hide the cancel button on an ASP.NET ChangePassword control

I'm considering using the ChangePassword control on an ASP.NET 2.0 Webform. I don't want the 'cancel' button to show. Is there a good way to hide it without resorting to silly "width = 0" sort of games? Or perhaps there's a generic way to walk through the parts of a composite control like this and hide individual parts? ...

Traditional ASP .NET Web Forms vs MVC

As someone with some winforms and client applications experience - is it worth going back and learning the way traditional ASP .NET pages work, or is it okay with moving straight into ASP .NET MVC? I'm kind of looking for pitfalls or traps in my knowledge of general C#, that I won't know from the screencast series and things on the ASP ...

What do you do when you can't use ViewState?

I have a rather complex page that dynamically builds user controls inside of a repeater. This repeater must be bound during the Init page event before ViewState is initialized or the dynamically created user controls will not retain their state. This creates an interesting Catch-22 because the object I bind the repeater to needs to be c...

Why does the ASP.Net Web Forms model "suck"?

I've heard Jeff Atwood, Joel Spolsky, and many other legendary people talk about how the ASP.NET Web Forms model sucks (so this question is kind of directed to them, hopefully Jeff is reading). Now, I highly respect their opinion, given their background and expertise, but truth be told, I absolutely LOVE Web Forms. I think the model is ...

What is the best approach for (client-side) disabling of a submit button?

Details: Only disable after user clicks the submit button, but before the posting back to the server ASP.NET Webforms (.NET 1.1) Prefer jQuery (if any library at all) Must be enabled if form reloads (i.e. credit card failed) This isn't a necessity that I do this, but if there is a simple way to do it without having to change too much...

How to Dynamically Generate String Validation?

Does anyone know of a library (preferably php) or algorithm for auto-generating regex's from some common descriptions? For example, have a form with the possible options of: Length (=x, between x & y, etc) Starts with Ends with Character(s) x(yz) at index i Specify one or more alternative behavior based on the above And so on.. The ...

Best way in asp.net to force https for an entire site?

About 6 months ago I rolled out a site where every request needed to be over https. The only way at the time I could find to ensure that every request to a page was over https was to check it in the page load event. If the request was not over http I would response.redirect("https://mysite.com") Is there a better way -- ideally some s...

Asp.Net Form DefaultButton Error in Firefox

The .Net generated code for a form with the "DefaultButton" attribute set contains poor javascript that allows the functionality to work in IE but not in other browsers (Firefox specifcially). Hitting enter key does submit the form with all browsers but Firefox cannot disregard the key press when it happens inside of a <textarea> contr...

How do I remove items from the query string for redirection?

In my base page I need to remove an item from the query string and redirect. I can't use Request.QueryString.Remove("foo") because the collection is read-only. Is there any way to get the query string (except for that one item) without iterating through the collection and re-building it? ...

How do you get the logged in Windows domain account from an ASP.NET application?

We have an ASP.NET application that manages it's own User, Roles and Permission database and we have recently added a field to the User table to hold the Windows domain account. I would like to make it so that the user doesn't have to physically log in to our application, but rather would be automatically logged in based on the curre...

ASP.Net RSS feed

How do I create an rss feed in ASP.Net? Is there anything built in to support it? If not, what third-party tools are available? I'm thinking webforms, not MVC, though I suppose since this isn't a traditional page the difference may be minimal. ...

What are my options for having the RadioButtonList functionality of ASP.NET in WinForms?

Is this type of control only available in a 3rd-party library? Has someone implemented an open source version? ...

When should you use standard html tags/inputs and when should you use the asp.net controls?

As I put together each asp.net page Its clear that most of the time I could use the standard html tags just as easily as the webforms controls. When this is the case what is the lure of the webforms controls? ...

Best way to implement mutliple Default Buttons on a ASP.NET Webform

What is the best way to implement mutliple Default Buttons on a ASP.NET Webform? I have what I think is a pretty standard page. There is a login area with user/pass field and a login button. Then elsewhere on the same page there is a single search field with a search button. ...

One Update Panel vs. Multiple Update Panels

I have an ASP.NET web page that displays a variety of fields that need to be updated best on certain conditions, button clicks and so on. We've implemented AJAX, using the ASP.NET Update Panel to avoid visible postbacks. Originally there was only one area that needed this ability ... that soon expanded to other fields. Now my web page ...

SelectedIndexChanged event handler getting old index

I'm handling the onSelectIndexChanged event. An event is raised when the DropDownList selection changes. the problem is that the DropDownList still returns the old values for SelectedValue and SelectedIndex. What am I doing wrong? Here is the DropDownList definition from the aspx file: <div style="margin: 0px; padding: 0px 1em 0px 0px;...

forms and jquery

I'm creating a simple form for a site I manage. I use JQuery for my javascript. I noticed a large amount of plugins for JQuery and forms. Does anybody have any favorites that they find especially useful? In particular, plugins to help with validation would be the most useful. ...