Thursday, March 6, 2014

mvc razor textboxfor change event change another textboxfor value







Based on value of Weight, Rate , CNF & AWB it will change the value of Freight, TTLCNF anfd TTLFright.

Freight= Weight*Rate;
TTLCNF  = Weight*CNF;
TTLFright=  Freight+TTLCNF  +AWB;




    @Html.TextBoxFor(model => model.Weight, new { onChange="return GetWight(this);"})  
  @Html.TextBoxFor(model => model.Rate, new { onChange="return GetWight(this);"})/Kg  
  @Html.TextBoxFor(model => model.Freight, new {disabled = "disabled" , @readonly = "readonly" ,onChange="return GetTTLFright(this);"})  
  @Html.TextBoxFor(model => model.CNFPK, new { onChange="return GetCNFPK(this);"})  
   @Html.TextBoxFor(model => model.TTLCNF, new {disabled = "disabled" , @readonly = "readonly",onChange="return GetTTLFright(this);" })  
   @Html.TextBoxFor(model => model.AWB, new { onChange="return GetTTLFright(this);"})  

and script


 <script>  
   function GetWight(ctr) {  
     var x = $("#Weight").val();  
     var y = $("#Rate").val();  
     var total = x * y;  
     $("#Freight").val(total);  
   }  
   function GetCNFPK(ctr) {  
     var p = $("#Weight").val();  
     var q = $("#CNFPK").val();  
     var totalCNFPK = p * q;  
     $("#TTLCNF").val(totalCNFPK);  
   }  
   function GetTTLFright(ctr) {  
     var p = $("#Freight").val();  
     var q = $("#TTLCNF").val();  
     var s = $("#AWB").val();  
     var totalTTLFright = parseFloat(p) + parseFloat(q) + parseFloat(s);  
     $("#TTLFREIGHT").val(totalTTLFright);  
   }  
  </script>  

SQL Get all Index create script from Database

To get all script from database as a create new index into another database you can use the following --Get all Index Script SELECT...