﻿function GetClassJson(classname,prms)
{
    var json="";
    var datalist = [];
      $(classname).each(function(i, selected){
          var id =$(selected).attr('id');
          var value = $(selected).val();
          index = id.lastIndexOf("_");
          if(index>-1)
          {
            var sid = id.substring(index+1,id.length);
            json = json + "'"+ sid +"':'" +value +"',";
          
          }
          else
          json = json + "'"+ id +"':'" +value +"',";
         
      });
      json = json.substring(0,json.length-1);
      json = "{"+ prms + json + "}";
      return json;
}

function JsonControls(controls)
{
    var json ="{";
    jQuery.each(controls, function() {
      json =json + JsonControl(this);
    });
    return json + "}";
}
function JsonControl(control)
{
  return "'"+control+"':'"+ $("#" + control).val() +"',";
}
function JsonArrControls(controls)
{
    var json ="";
    jQuery.each(controls, function() {
      json =json + JsonControl(this);
    });
    return json;
}
