Tagged with jquery

String.Format in Jquery

  Code Snippet postcodeSelections += $.validator.format('<select size="4" name="{0}" id="{1}" tabindex="10" class="dropdownPostcodes">', postcodeSelectionsIdentifier, postcodeSelectionsIdentifier);

jQuery filter()

Nice to use when in need of extract a subset from an array based on one or more clauses. The equivalent of the Where condition in Linq. In the below snippet we filter all the hidden fields with an Id starting with “hidden” and where the value is not empty: var allHiddenFields = $.find(‘input[id^=hidden]’);var allHiddenFieldsWithValue … Continue reading

JQuery select handling

A few snippets for when it comes to handle selectboxes: //find an option by value var foundOption = $(“#ddlPhoneCode option[value=’AS’]”); //get selected option var foundOption = $(“#ddlPhoneCode”).val(); //remove an option from the control $(“#ddlPhoneCode option[value=’AS’]”).remove(); //get values from multi-select var foundOptions = []; $(‘#ddlPhoneCode:selected’).each(function(i, selected){ foundOptions[i] = $(selected).text(); }); //select an option into the select … Continue reading

Easy Jquery validation in Asp.net 4

With Asp.net 4 comes a new property named ClientIDMode wich allow us to take control over the control ID rendered client side. The property can be applied at: Page level, all the controls within page will maintain the same ID specified by the developer : <%@ Page Title=”” Language=”C#” MasterPageFile=”~/MyMaster.Master” CodeBehind=”NewFeature.aspx.cs” ClientIDMode=”Static”…. Control level , … Continue reading

Easy Asp.net ajax file upload

Here’s a simple way to get file uploading without the widraw of a postback: it is the asp.net implementation (with a few changes) of the following jQuery plugin. An image is uploaded and the form submitted. The submitted form is sent to a custom handler (ashx). The image is saved to a website folder and … Continue reading