Posts

Showing posts with the label JavaScript

Setting multiple choices using jquery chosen pluging

$('#ShopId').val(array).trigger('chosen:updated'); $ ( '#btnshop' ). click ( function () { $ ( '#ShopId' ). chosen ( 'destroy' ). val ([ "shop1" , "shop2" , "shop3" ]). chosen (); });   $.ajax({             url: 'CustomerReport/GetAllShop',             data: {},             success: function (data) {                 var array = [];                 $(data.data).each(function (index, car) {                     array.push(car.ShopID);                 });                 $('#ShopId').val(array).trigger('chosen:updated');             },             error: function () {         ...

Open New Window inside Update Panel in C# using JavaScript code

string URL = ResolveUrl("~/Report/Viewers/ReportViewer.aspx?ReportType=AssembleIssueReport&ItemIssueNo=" + issue.ChallanNo + "");                     ScriptManager.RegisterStartupScript(UpdatePanel1, typeof(string), "Package", "window.open('" + URL + "');", true);

ajax calls not working with ASP.Net Web Forms

<script type = "text/javascript" > $ ( document ). ready ( function () { $ . ajax ({ url : '/Default.aspx/GetData' , type : 'POST' , beforeSend : function ( xhr ) { xhr . setRequestHeader ( "Content-type" , "application/json; charset=utf-8" ); }, success : function ( result ) { var resultData = ( result . d ? result . d : result ); alert ( resultData ); }, error : function (){ alert ( 'error' ); } }); }); </script> [ System . Web . Services . WebMethod ] public static string GetData () { return "Hello" ; } Add FriednlyUrls to the project. Remove the line in  RegisterRoutes  method that sets  settings.AutoRedirect...

AngularJS Dynamic table with add/remove

<body ng-app= "myapp" ng-controller= " TestController" > <div class= "container" > <div class= "row" > <div class= "col-md-12" > <div class= "panel panel-default" > <div class= "panel-body" > <form ng-submit= "addNew()" > <table class= "table table-striped table-bordered" > <thead> <tr> <th><input type= "checkbox" ng-model= "selectedAll" ng-click= "checkAll()" /></th> <th> Firstname </th> <th> Lastname </th> ...