Posts

Showing posts from September, 2012

Easy Sort Html Table / Grid View using JQuery example

1st u need the gloruis sortElements by James Padolsey (well after getting JQ) 
http://james.padolsey.com/javascript/sorting-elements-with-jquery/

now grid views gives us a row with TH and the rest r TD so we need:
1 - take all the TRs
2 - build the compare callback func
3 - make it skip the TH
4 - be able to sort desc

so here, i put this just after James's code:

function MakeTableSortable(tableID) {
  $("#" + tableID + " th").click(function () {
    var index = this.cellIndex;
    if (this.abc == null) {
      this.abc = true;
    }             else {
      this.abc = !this.abc;
    }

    $("#" + tableID + " tr").sortElements(function (a, b) {
if (a.cells[0].tagName == "TH"

Create Class in Javascript example

taken right from here (a hebrew blog, no. 2 in list) http://www.softwarearchiblog.com/2012/05/javascript-java-c-1.html http://www.softwarearchiblog.com/2012/06/javascript-java-c-2.html http://www.softwarearchiblog.com/2012/07/jquery-c-java.html

var myNS = myNS || {}; // ns is optional o.c.
myNS.Calculator = function () {
// private members
var value = 0;

var addBy = function (x) {
value += x;
    console.log('value = ' + value);
};
  var multiplyBy = function (x) {
value *= x;
    console.log('value = ' + value);
};

return { // public parts (aka interface)
addBy: addBy,
    multiplyBy: multiplyBy
  };
};
var calc = new myNS.Calculator();
calc.addBy(4);
calc.multiplyBy(6); // 24

pass Info from web.app to Dll

in the web.app:
Configuration config = WebConfigurationManager.OpenWebConfiguration("~/");
#if QA
config.AppSettings.Settings.Add("EnviormentVar", "QA");
#endif
config.Save();

in the dll:
System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration("~/");
KeyValueConfigurationElement Appsetting = config.AppSettings.Settings["EnviormentVar"];
return (Appsetting.Key + " <br/>" + "Value:" + Appsetting.Value);

u'll get: 
Appsetting.Value = QA