# Category: asp.net

## DropDownListFor inside ng-app lost selected value on postback

It works only if I remove the angularjs directive ng-app: Doesn’t work: <div ng-app=””> @Html.DropDownListFor… </div> It works: <div> @Html.DropDownListFor… </div> Any idea on how to maintain the selected value on post back inside an angularjs ng-app? Source: AngularJS

## Nav and DOM are "shifting" slightly when I go from page to page

I am writing a full-stack app, with a C#/ASP.NET back-end, and an AngularJS/Bootstrap 4 front-end. Once a particular page has enough rendering in the DOM to need a vertical scroll bar, I’ve noticed a slight shifting of pretty much everything as you navigate to and from that page. I’ve spent several days trying to figure this out, but no such luck. I did notice that a slightly similar question was asked about 3 years ago […]

## typescript cant debug on vs15.7

when i create Aspcore2.1 angulars Porject,the typescript breakpoint not use (but aspcore 2.0 is fun). For eg: this is debugging on VS15.7.3_AspCore2.1 Source: AngularJS

## Difference between TryGetValue() and GetorCreate()?

I’m making a web app with ASP.NET MVC and Angular. To cache results for the main dashboard I’m using the inbuilt IMemoryCache. I’m using GetorCreate for its Async version, but what’s the real difference between TryGetValue() and GetorCreate()? Don’t they both try and get the value from cache, but if it isn’t we can make it? Source: AngularJS

## How to download file from web api using token based athorization

How to call a WEB API method to download file when the web api uses token based authorization? We are able to download the file if we don’t have authorize and if we give window.location.href = “/api/CaseDetailsSvc/DownloadCaseDoc?strFileName=” + fileName . But we would like to be able to allow only authorized users to call this web api method. How to solve this? Here’s the code we have: [Authorize(Roles = “RspCaseEdit”)] public class CaseDetailsSvcController : ApiController […]

## Url Rewrite works fine in Angular Js but causes 404 Error on reloading page [duplicate]

This question already has an answer here: How do I configure IIS for URL Rewriting an AngularJS application in HTML5 mode? 5 answers I have been working with URL rewriting, I have done all the basic steps which include enabling html5 mode, adding base href to master page, and adding rewrite rules in web.config. Now it rewrites the URL From localhost:5050/index.html#/Home to localhost:5050/Home But when I refresh this page it gives the 404 not found […]

## File Upload Error :- System.IO.FileNotFoundException c#

Asking an old question again as the solutions out there haven’t worked for me. While trying to update a file I get this exception :- System.IO.FileNotFoundException I’m sending file via my AngularJS file as:- $scope.ChechFileValid($scope.SelectedFileForUpload); if ($scope.IsFileValid) { var formData = new FormData(); formData.append(“File”,$scope.SelectedFileForUpload); formData.append(“Tbl”, itemTbl); formData.append(“ID”, itemId); formData.append(“Name”, EditName); formData.append(“Desc”, EditDesc); formData.append(“Status”, EditStatus); formData.append(“SEOTitle”, EditSEOTitle); formData.append(“SEOKeyword”, EditSEOKeyword); formData.append(“SEODesc”, EditSEODesc); show_ajax_loader(); //var Data = \$.param({ ID: itemId, Tbl: itemTbl, Name: EditName, Desc: EditDesc, Status: […]

## Angular in external file not working

To make it easy to understand, I made two examples of which one works and the other doesn’t. The first one is the script content inside html page and it is working fine. <html ng-app> <head> <script type=”text/javascript” src=”https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js”></script> </head> <body> <input type=”text” ng-model=”helloAngular” /> <h1>{{helloAngular}}</h1> </body> </html> This is the part of code that is not working (inside the same html page): <div ng-app=”app”> <p>Try to change the names.</p> <div ng-controller=”personController”> <p> First Name: […]

## Multiple level loop of same entity using AngularJS ng-repeat-start and ng-repeat-end in HTML table tag

Lets assume that I have an entity called GrandPa which is passed to my razor view, its model is as below(ParentChiled). As u see Child property is the List of ParentChiled class, using that GrandPa entity has 2 inner Child list of ParentChiled type which I want to loop thru each child also and print there Name. Class ParentChiled { public string Name {get;set;} public List<ParentChiled> Child {get;set;} //list of current class } here what […]

## How to clean WEB client caching post deploy? [on hold]

The users still see the old pages and must perform manual cache cleaning. I tried to add the HTML tags, however it didn’t help. How to avoid it? Source: AngularJS