Jul 15th, 2009 | No Comments

Recently our team came across a situation where our job was to retrieve ArrayList in a page requested by flex application using HttpService.Which are accessed using Request[keyName]

Request objects always returns data in string format, so there was no point in trying that solution, so we were looking for some reliable and optimal solution. Googling around I came across JSON (Javascript Object Notation).JSON can be used in various languages, you can find the list of langauges and the resources requied to use JSON over here.

JSON allows us to serialize a object and send across a page in string format.All we need to do is to perform Deserialization on the requested page.

This is the sample code which demonstrates the use of JSON to send arraylist to another page.

The code below contains 2 arraylist which need to be send on another page.The arraylist are serialized and sent to different page with the help of querystring.

ArrayList list = new ArrayList();
ArrayList list1 = new ArrayList();
list1.Add("one-one");
list1.Add("one-two");
list1.Add("one-three");
list1.Add("one-four");
list.Add(list1);
list.Add("two");
list.Add("three");
string arrayList = JavaScriptConvert.SerializeObject(list);
Response.Redirect("Process.aspx?list="+arrayList);

The code below Deserialize and typecast the object to JavaScriptArray.

string arrayList = Request["list"];
JavaScriptArray list = (JavaScriptArray)JavaScriptConvert.DeserializeObject(arrayList);

You can download sample code from here.

Enjoy Coding :)

Written by Ajay Matharu

July 15th, 2009 at 9:20 pm

Jul 13th, 2009 | No Comments

In Access, you can limit user entries by forcing users to choose a value from a list control. Office applications use the same functionality in built-in drop-down lists. For instance, the Highlight and Font Color controls on most Formatting toolbars use this flexible tool. Simply click the small triangle to the right of the icon to display a list of choices.

You can create the same type of control for your users in an Excel sheet, but the process isn’t intuitive. The option is in the Data Validation feature. Fortunately, once you know the feature exists, it’s easy to implement. You need only two things: a list and a data entry cell. The following sheet shows a simple drop-down list in an Excel sheet.

excel

Users click the drop-down arrow to display a list of items from A1:A4. If a user tries to enter something that isn’t in the list, Excel rejects the entry. To add this drop-down list to a sheet, do the following:

  1. Create the list in cells A1:A4. Similarly, you can enter the items in a single row, such as A1:D4.
  2. Select cell E3. (You can position the drop-down list in most any cell or even multiple cells.)
  3. Choose Validation from the Data menu.
  4. Choose List from the Allow option’s drop-down list. (See, they’re everywhere.)
  5. Click the Source control and drag to highlight the cells A1:A4. Alternately, simply enter the reference (=$A$1:$A$4).
  6. Make sure the In-Cell Dropdown option is checked. If you uncheck this option, Excel still forces users to enter only list values (A1:A4), but it won’t present a drop-down list.
  7. Click OK.

You can add the drop-down list to multiple cells. Select the range of data input cells (step 2) instead of a single cell. It even works for noncontiguous cells. Hold down the Shift key while you click the appropriate cells.

It’s worth noting that the drop-down arrow is visible only when the cell is active.

Written by Ajay Matharu

July 13th, 2009 at 9:27 pm