Posts

Showing posts from September, 2016

jquery each()

What is jQuery .each() jQuery’s each() function is used to loop through each element of the target jQuery object. In case you’re not really experienced in jQuery, I remind you that a jQuery object is an object that contains one or more DOM elements, and exposes all jQuery functions. It’s very useful for multi-element DOM manipulation, looping arbitrary arrays, and object properties. In addition to this function, jQuery provides a helper function with the same name that can be called without having previously selected or created DOM elements. Let’s find out more in the next sections. jQuery’s .each() Syntax Let’s see the different modes in action. The following example selects every div on the web page and outputs the index and the ID of each of them. A possible output is: “div0:header”, “div1:body”, “div2:footer”. This version uses jQuery’s each() function as opposed to the utility function. // DOM ELEMENTS $ ( 'div' ) . each ( function ( index , va

communication between view and controller using ajax request

there are multiple ways of send a request to controller and returning data to populate dropdown or grid etc 1. send ajax request > return string array > parse to json > iterate through result SERVER SIDE / CONTROLLER   public string Get(string argSelectedValue) {      List resultList = new List();      SelectListItem selListItem = new SelectListItem() { Value = "null", Text = "Select One" };      resultList.Add(selListItem);      JavaScriptSerializer js = new JavaScriptSerializer(); return js.Serialize(new SelectList(resultList, "Value", "Text")); }   CLIENT SIDE / AJAX REQUEST  $.ajax({ url: "/Lookup/Get", type: 'POST', data: { argSelectedValue: FromType }, success: function (response) { var listItems = ""; var json = $.parseJSON(response); for (var i = 0; i < response.length; i++) { listItems += " " + response[i].Text

String or binary data would be truncated

While inserting row in SQL Server, whenever you encounter such error then you need to re-verify whether or not you are exceeding any column value for example in your sql table you have defined length of other_name as char(12) create table users ( code integer identity(1,1) primary key, username varchar(32) not null unique, other_number char(12) not null ) and if your insert statement is as follows insert into users (username,other_number) values('admin','1234567890123'); only then this error will come i.e  String or binary data would be truncated which means you are exceeding length check of column named other_name  therefore reducing it will insert row successfully like below. insert into users (username,other_number) values('admin',' 123456789012 ');

icons not displaying properly in windows

Sometimes due to few installations, you feel like the folder / file icons are not being displayed the way it should be, i am sharing you the way of solving such problem. Here's a slightly quicker version of the instructions. 1. Press Ctrl-Shift-Escape to get the task manager. 2. In the Processes tab, click on explorer.exe and click End Process. You'll get a confirmation dialog. Click "End Process" to confirm. 3. From the File menu (still in the task manager), choose New Task (Run...). 4. Copy/paste/enter the following command in the run box: Code: cmd /c del %userprofile%\AppData\Local\IconCache.db /a 5. Open the Run box again with File --> New Task (Run...). This time, enter this command: Code: explorer.exe 6. All should be okay now. Open the Start Menu and confirm that your icons are fixed now.