|
Solved: Thanks. I found the solution after so many trials. I think I should share this so that anyone with such problem could resolve it with ease. The problems was from my webpage submitting an empty filename because of the page load event. So, the solution to this problem is ensure that the uploaded filename is intact before calling the SaveAs command.
Once again, thanks for your reply.
Cheers!
|
|
|
|
|
Well yes that's a good idea.
But the way your mapping out the path may backfire on you when you publish your web app for production use.
Uploading files of anything requires good knowledge of how it works. There about 5 ways to do it to my knowledge.
I don't use the file name of the file anymore, for now I assign my own name to the file. Later on down the road, as users keep uploading the same file with different names, you will have gigs of files sitting in the folder, and the project size will radically expand in size over the course of time. Then what? That's another topic for discussion.
|
|
|
|
|
Anybody please suggest how to set the DataTable Width in dot net.
|
|
|
|
|
What DataTable are you talking about? Have you checked the documentation for class properties?
|
|
|
|
|
DataTable does not have a width, DataTable Properties (System.Data)[^], since it does not have a UI component.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi All,
I am writing my AngularJS - js file as below and using ng-repeat as well as below, but when I add or remove item into the list angularJS is not refreshing it automatically on View, am I missing something, it is happening on IE but on Chrome its refreshing the list automatically. Am I missing something or do I need to explicitly refresh the list etc to show the most updated list on IE, I have to use only IE at my work - please any help is appreciated thank you.
Here is my View
<body><br />
<div data-ng-app="myApp" data-ng-controller="userController">
<table style="border:none 0px gray;">
<tr>
<td>
<table style="border:solid 1px gray;">
<tr>
<td style="border:solid 1px gray;">User Id</td>
<td style="border:solid 1px gray;">User Name</td><br />
</tr>
<tr data-ng-repeat="usr in users">
<td><a href="/User/UpdateUser/{{usr.UserId}}"> {{usr.UserId}} </a> </td>
<td><a href="/User/UpdateUser/{{usr.UserId}}">{{usr.UserName}}</a></td><br />
</tr>
</table>
<pre>
</td>
<td>
<a href="http://www.codeproject.com/Members/html">@Html</a>.ActionLink("Create User", "CreateUser")
</td>
</tr>
</table>
</body>
And here is my script
var myApp = angular.module('myApp', []);
myApp.controller('userController', ['$scope', '$http', function ($scope, $http) {
$scope.users = "";
$http.get("/User/GetUsers")
.success(function (result) {
$scope.users = result;
})
.error(function (result) {
console.log(result);
});
}]);
Here is my Controller Action method, when an item is added to the list, it will call the Idex method which calls this AngularJS function but some how the function is not getting called and the update on the View is not showing up, please help me.
public ActionResult CreateUser()
{<br />
return View();
}
[HttpPost]
public ActionResult CreateUser(FormCollection collection)
{
try
{
string Id = Request.Form["UserId"];
string UserName = Request.Form["UserName"];
int UserId;
var dbContext = new MVCDBContext();
User user = new User();
user.UserId = (int.TryParse(Id, out UserId) ? UserId : 0);
user.UserName = UserName;
dbContext.Users.Add(user);
dbContext.SaveChanges();
return RedirectToAction("Index");
}
catch
{
return View();
}
}
Thanks in advance.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
modified 31-Jul-16 5:00am.
|
|
|
|
|
If it's working in Chrome, but not in IE, then it's an IE compatibility issue.
Which version of IE are you using? And which version of AngularJS?
According to this document[^], v1.3+ support IE9+. They automatically run tests against IE9, IE10 and IE11, so it should work in those versions, with a few caveats which are listed in that document.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Its IE 11 I think it should work without issues.
And my AngularJS version is: AngularJS v1.5.5
Is it a problem?
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
According to the Angular site, that should be fine.
Can you reproduce the problem in a simple JSFiddle[^]?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Sorry the problem is its not one form and the problem not happening when I call first time, it happens when I insert into Database by using "Create Form" and redirect to the List page using "Action method", whatever is inserted in to Database using Action method should reflect in the List page when its loaded.
First time yes AngularJS is bringing all data I think maybe second time IE is just getting values from Cache rather than calling the method to get values from database.
Is there anyway to escape from this behavior of IE.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Yes, caching sounds like the culprit.
There are various options to disable caching. You can either change the server code to override the caching headers; or configure the caching headers in IIS; or change the Angular configuration[^] to prevent it from caching responses to AJAX requests.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Use ng-href instead.
<td><a ng-href="/User/UpdateUser/{{usr.UserId}}"> {{usr.UserId}} </a> </td>
<td><a ng-href="/User/UpdateUser/{{usr.UserId}}">{{usr.UserName}}</a></td>
See: https://docs.angularjs.org/api/ng/directive/ngHref[^]
Also:
<a href="http://www.codeproject.com/Members/html">@Html</a>.ActionLink("Create User", "CreateUser")
Not sure if this happened when you pasted it in, but that's pretty broken.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Yes
"@Html.ActionLink("Create User", "CreateUser")"
This happened why I posted.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
How can I print from web application in asp.net mvc ? Please check "PrintFromWebApplication" document. pdf PrintFromWebApplication [PDF/274KB] http://download.brother.com/pub/com/dev/pdf/bpac_webapplication_eng.pdf
|
|
|
|
|
No. What exactly is your question?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
i want build print in client ...using asp.net mvc .thanks
|
|
|
|
|
mvc runs on the server, you can't create client software with it. You need to focus on a technology that will deliver what you want.
|
|
|
|
|
How to create CRUD operation using WebService and call it in mvc4
pls reffer the related tutorials and your valuable guidance..
|
|
|
|
|
sunil3 wrote: pls reffer the related tutorials You can try Web Development[^] or a general search through Google.
|
|
|
|
|
I have 1 image as background and other as main image, now i need to do drag main image and drop on background image and save combined image using mvc.net 5.0
|
|
|
|
|
Better start writing some code then, you're going to need a lot of it 
|
|
|
|
|
at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at System.Collections.Generic.Dictionary`2.ContainsKey(TKey key)
at System.Collections.Generic.Dictionary`2.KeyCollection.System.Collections.Generic.ICollection<TKey>.Contains(TKey item)
at DotNetAgent.Trackers.ComponentCountInfo.RecordExternalComponent(String componentName)
at DotNetAgent.Trackers.DefaultTracker.Finish()
at DotNetAgent.Trackers.db.DbCommandTracker.Finish()
at DotNetAgent.Trackers.DefaultTracker.Exit()
at DotNetAgent.Sequences.Sequence.FinishTracker(ITracker tracker, IAgent agent)
at DotNetAgent.Instrumenter.Factories.Web.CallHandlerExecutionStepTrackerFactory.FinishTracker(Object dummy)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously
|
|
|
|
|
We can't see your screen. We can't access your computer. We can't read your mind.
Even if we had the error message, which you managed to avoid posting, we don't have access to your code. Without seeing your code, we can't tell you what the problem is.
All we can tell you is that part of your code is using a Dictionary<TKey, TValue> incorrectly. If I had to guess, I'd say you're using it from multiple threads without proper synchronization, which is corrupting the internal state. If that's the case, then I'd suggest using a ConcurrentDictionary<TKey, TValue>[^] instead.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hello, I wrote my first API today and I used AutoMapper. I have a simple clarification question about the bolded line of code here:
public IEnumerable<MoviesDto> GetMovies()
{
return _context.Movies.ToList().Select(Mapper.Map<Movie, MoviesDto>);
}
I am aware that Mapper.Map is an AutoMapper function which is mapping my domain model to my Data Transfer Object (I wrote all of this code from scratch earlier), but I'm slightly confused on this syntax...
Is this basically pulling all of the data in my Movies table out of the database and then taking it and inserting the values into my DTO's properties and then returning those Dto properties to the client all in one step??? I'm guessing that is what it is doing but I'm not 100% sure. Sorry for the ignorance, I've only been coding since May but am excited to have made my first API!
|
|
|
|
|
The .ToList() call pulls all of the data from your Movies table into memory.
The .Select(...) call is part of Language-Integrated Query (LINQ)[^]. It's a projection operation[^] which converts a sequence of values of one type into a sequence of values of a different type, by calling a user-defined function for each item in the source sequence. In this instance, the function it calls is Mapper.Map<Movie, MoviesDto> , which is the AutoMapper function to translate your data class to your DTO class.
It's almost equivalent to something like this:
List<Movie> movies = new List<Movie>();
foreach (Movie movie in _context.Movies)
{
movies.Add(movie);
}
List<MoviesDto> result = new List<MoviesDto>();
foreach (Movie movie in movies)
{
MoviesDto dto = Mapper.Map<Movie, MoviesDto>(movie);
result.Add(dto);
}
return result;
The main difference is that LINQ is lazily evaluated. The Select projection isn't processed until the returned sequence is enumerated, and the items are processed as they are requested, rather than being stored in a list.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|