webforms

LINQ: Get all selected values of a CheckBoxList using a Lambda expression

Consider a scenario where you want to retrieve a List or IEnumerable of the values of all the selected checkboxes in an <asp:CheckBoxList>. Here's the current implementation: IEnumerable<int> allChecked = (from item in chkBoxList.Items.Cast<ListItem>() where item.Selected ...

How is mime type of an uploaded file determined by browser?

I have a web app where the user needs to upload a .zip file. On the server-side, I am checking the mime type of the uploaded file, to make sure it is application/x-zip-compressed or application/zip. This worked fine for me on Firefox and IE. However, when a coworker tested it, it failed for him on Firefox (sent mime type was something...

Options for return ajax requests in a asp.net webforms app

Hi, I have a webforms application, and I need to create a way to respond to ajax requests. I will be either returning HTML or json responses (or maybe even XML). Should I create a .aspx page for this or a handler of some sort? Is setting the content type tricky? ...

ASP.NET Wizard Back Button won't work

I have a ASP.NET Wizard running my checkout process of my shopping cart. I just added a Paypal Express checkout link to my 2nd step. The Paypal process takes the user away from the page and then redirects them back to my wizard when they're done. I'm parsing an HTTP parameter with Request.QueryString when the user comes back from Payp...

How to implement a Client-side Ajax Login on Asp.Net MVC (A link to the solution for Asp.Net Webforms is in here)

Hi, I'm trying to implement a client-side ajax login on Asp.Net MVC. I used to have this set up just fine on WebForms, but now that I've moved to MVC it's giving me some troubles. If you'd like a tutorial on Client-side Ajax Login for Asp.Net Webforms, it can be found here -- Easy, A++ Now... for some reason it's not working for Asp.N...

Chevrons in Routing URLs with WebForms 3.5

I've just upgraded my old wildcard mapping based URL system to use System.Web.Routing. Before, I was able to request the URL /Service/GetItems<My.Full.Item.Type>, which was parsed on the other side and returned exactly what you'd expect. That was neat. Now with Routing on, any request with a < or > in it returns me the contents of '/'...

Using generics to process asp.net form request variables into business object

Using jquery to post values back to an asp.net webform. I have some code that works great for sticking posted Form values into my object, basically it converts the form values into the correct type for each property in my class. if (Request.Form.HasKeys()) { foreach (var key in Request.Form.AllKeys) { PropertyInfo itemP...

How to deal with mutiple forms in ASP .NET

Short description of the page: user searches for an account (first form is to search for an account), account information gets displayed below and you can make changes to that account (second form). I currently have this feature in only one form, but I am running into problems when I try to validate (since pressing any of the two button...

[WebForms] Validate more than two words as minimum on asp:textbox

Hello I want to validate the input, so the method for count words is the following : public static string validateisMoreThanOneWord(string input, int numberWords) { try { int words = numberWords; for (int i = 0; i < input.Trim().Length; i++) { ...

gmail type filechooser for firefox

I have a simple requirement: One browse button opens multiple file choosers. When file is chosen, its filename gets added to an order list. This works just fine in IE, because i can programatically click on hidden file inputs, but firefox does not let the click event open the file choose dialog. Question: What options do i have? ...

[WebForm] Validation using jQuery.validate.js (plug-in)

I want to Validate almost just one field from two is required for client submit. something like groupValidation property for make their exclusively dependent on validation postback Im using ASP.NET Webforms - C# 3 ...

How to capture submit event using jQuery in an ASP.NET application?

I'm trying to handle the submit event of a form element using jQuery. $("form").bind("submit", function() { alert("You are submitting!"); }); This never fires when the form submits (as part of a postback, e.g. when I click on a button or linkbutton). Is there a way to make this work? I could attach to events of the i...

LINQ: find all checked checkboxes in a GridView

Consider the current algorithm below that iterates through a GridView's rows to find whether the contained Checkbox is selected/checked. List<int> checkedIDs = new List<int>(); foreach (GridViewRow msgRow in messagesGrid.Rows) { CheckBox chk = (CheckBox)msgRow.FindControl("chkUpdateStatus"); if (chk.Checked){ //we want the GridV...

Creating forms for relational data in Rails

I have a form that I need to display for a table that has a relationship with a couple of other tables. For instance, I have a table "cases" (think, investigator case), that has_one claimant and has_one client. I would like the form to display the fields to fill out for the case data, client data and claimant data. Is there an easy ...

IE not passing @ symbol for email input on GET form

Hi guys, I'm trying to pass an email through a GET form, but in IE, it strips out the @ symbol on the page with the GET parameters. I'm using an onSubmit event, but all those do is validate the data before letting them submit, it doesn't touch any of the form values. <form name="quick" id="ex" action="order" autocomplete="off" method="G...

Better WebForms inspired by asp.net MVC

Hi, I work on asp.net applications 'in-house' and would love to use asp.net mvc, but am not able to as our applications are deployed to web servers that are not in our control and currently only have .net framework v2 and IIS6. As well as there being no possibility of having time/money spent on converting current WebForms applications.....

Formchecking functions in php

I'm working on a registration form in PHP and I'm wonder what the essential functions are to make sure my database is safe. I'm sure there are a lot of ways to both protect your database or attack one, but I'm asking the advice of stackoverflow: what functions or things must you apply to your data before inserting it into the database. ...

Using PHP Filter function to validate, but ignore empty non-required fields

I want to use the PHP Filter functions to quickly filter a form and show feedback to the user. Some of the fields in my form are required, some are not. I am going to use filter_input_array() to filter all my fields. I will pass the data through in multiple runs. In this way, I will be able to display multiple error messages. I have on...

HTML form method="HEAD"

I've never seen this before, I've always known there was either GET or POST. And I can't find any good documentation. GET send variables via the URL. POST send it via the file body? What does HEAD do? It doesn't get used often, am I correct? W3schools.com doesn't even mention it. ...

I want different colours in my C# webform textbox!

I want to format lines of text differently in a .net C# webforms text box, eg. some lines italic or different colour? I know I can in windows forms, is there a richtextbox alternative for webforms? I find a lot of people asking but no answer...please can you help? ...