|
Is it possible to call a javascript function in a cshtml, in the @{} section, and the javascript function is defined in the script section of the cshtml.
Thanks
|
|
|
|
|
No, your cshtml is compiled and executed as .net code on the server, the result is that it generates html, that html is then sent to the client browser to be executed and the client browser can interpret and execute javascript. So you can't run javascript in your views as the javascript doesn't yet technically exist.
|
|
|
|
|
I have a list passed on to the view from the controller through a viewbag. so if the viewbag has the list, then execute a javascript function that is defined in the script section of the page. what is the other option?
|
|
|
|
|
<script type="text/javascript">
function myFunc() {
alert('Hello');
}
</script>
@if (ViewBag.MyList != null)
{
<script>myFunc();</script>
}
Note the order is important, js is interpreted in order so you can't call functions that have not yet been defined.
|
|
|
|
|
Hi,
I am trying to run npm install, I'm not sure what's it, all I doing is following an article to make my application workable with Angular 2.0, but its never stopping giving me errors. I don't know why is so tough to install it.
I have created package.json file, copied the following script init. ABCSolution is my solution name and ABCWebApp is my asp.net mvc application name, I don't know which one should I use for the name there, I putting the Solution Name
{
"version": "1.0.0",
"name": "ABCSolution",
"author": "Abdul Aleem",
"description": "This is for Calpers834",
"dependencies": {
"@angular/common": "2.0.0-rc.5",
"@angular/compiler": "2.0.0-rc.6",
"@angular/core": "2.0.0-rc.6",
"@angular/forms": "2.0.0-rc.6",
"@angular/http": "2.0.0-rc.6",
"@angular/platform-browser": "2.0.0-rc.6",
"@angular/platform-browser-dynamic": "2.0.0-rc.6",
"@angular/router": "3.0.0-rc.2",
"@angular/upgrade": "2.0.0-rc.6",
"@types/lodash": "^4.14.42",
"core-js": "^2.4.1",
"moment": "^2.14.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"systemjs": "^0.19.37",
"typings": "^1.3.2",
"zone.js": "^0.6.12"
},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-clean": "^0.3.2",
"gulp-concat": "^2.6.0",
"gulp-less": "^3.1.0",
"gulp-sourcemaps": "^1.6.0",
"gulp-typescript": "^2.13.6",
"gulp-uglify": "^2.0.0",
"typescript": "^1.8.10"
},
"scripts": {
"postinstall": "typings install dt~core-js --global"
}
}
I have created typings.json file and placed the following script there
{
"globalDependencies": {
"core-js": "registry:dt/core-js#0.0.0+20160602141332",
"jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
"node": "registry:dt/node#6.0.0+20160621231320"
}
}
I placed them in the Project folder first and ran the npm install from that same folder it gave me errors, then I placed these files in the Solution files, then ran the npm install, never leaving the errors.
I am frustrated and tired, I am not understanding what are those dependencies are what are those versions in them.
Can anybody please help me in this aspect, what went wrong, I really need this help a suggestion, a link or even a code snippet helps me greatly. What's this npm install why is it making my life so tired, I don't know.
And the error that I getting is as below:
npm ERR! peerinvalid The package @angular/common does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer @angular/forms@2.0.0-rc.6 wants @angular/common@^2.0.0-rc.6
npm ERR! peerinvalid Peer @angular/platform-browser@2.0.0-rc.6 wants @angular/common@^2.0.0-rc.6
npm ERR! peerinvalid Peer @angular/platform-browser-dynamic@2.0.0-rc.6 wants @angular/common@^2.0.0-rc.6
npm ERR! peerinvalid Peer @angular/router@3.0.0-rc.2 wants @angular/common@^2.0.0-rc.6
And if I am running "npm run typings install" in either the Project folder or Solution folder, then its giving me the following error:
npm ERR! missing script: typings
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <a href="https://github.com/npm/npm/issues">https:
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\aaleem01\Desktop\Calpers834\npm-debug.log
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
modified 7-Dec-16 17:19pm.
|
|
|
|
|
Hi,
I created a mvc web project with scaffolding that displays well in the Index page. When I edit, I do not want any of the fields in the edit page to edit. Instead, I added a textbox whose value I calculate and save the rest of the fields to the database. I cannot get this to work, as the model in the HttpPost is null. Please help.
Thanks
|
|
|
|
|
Have you looked into any tutorials about doing CRUD in ASP.NET MVC? You should be able get more references in the web. The idea is to send back the model to your action method if your action requires the model on POST request. I would really recommend you to read the basics on how MVC arch works before jumping into the limbo.
Here's an article that may help you understand the basic of ASP.NET MVC: ASP.NET MVC 5: Building Your First Web Application - Part 1[^]
|
|
|
|
|
There's a problem somewhere in your secret code. You should fix that.
If you want someone else to help you fix it, then you'll need to share the relevant parts of your code.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Did you wrap the textboxes and submit button in a form tag or element?, so the input elements post back to the controller.
21st Century Globalism has become Socialism on a planetary scale, in which the unequal treaties of the past have come back into play.
|
|
|
|
|
Hi,
I am trying to find a good C# example Web Application which is using MVVM pattern with AngularJS 2.0, I am trying my best but not able to find, just asking is AngularJS 2.0 suitable with MVVM pattern, if it is can some body point me where I can get some example and sample code to practice.
Thanks in advance my friends, I am also googling but not able to find it.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
|
I created project.json file
{
"version": "1.0.0",
"name": "ABCSolution",
"author": "Abdul Aleem",
"description": "This is for Calpers834",
"dependencies": {
"@angular/common": "2.0.0-rc.5",
"@angular/compiler": "2.0.0-rc.6",
"@angular/core": "2.0.0-rc.6",
"@angular/forms": "2.0.0-rc.6",
"@angular/http": "2.0.0-rc.6",
"@angular/platform-browser": "2.0.0-rc.6",
"@angular/platform-browser-dynamic": "2.0.0-rc.6",
"@angular/router": "3.0.0-rc.2",
"@angular/upgrade": "2.0.0-rc.6",
"@types/lodash": "^4.14.42",
"core-js": "^2.4.1",
"moment": "^2.14.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"systemjs": "^0.19.37",
"typings": "^1.3.2",
"zone.js": "^0.6.12"
},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-clean": "^0.3.2",
"gulp-concat": "^2.6.0",
"gulp-less": "^3.1.0",
"gulp-sourcemaps": "^1.6.0",
"gulp-typescript": "^2.13.6",
"gulp-uglify": "^2.0.0",
"typescript": "^1.8.10"
},
"scripts": {
"postinstall": "typings install dt~core-js --global"
}
}
I have created typings.json file and placed the following script there
{
"globalDependencies": {
"core-js": "registry:dt/core-js#0.0.0+20160602141332",
"jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
"node": "registry:dt/node#6.0.0+20160621231320"
}
}
when I ran the npm install its giving me the following error buddy, do you have any idea my friend
npm ERR! peerinvalid The package @angular/common does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer @angular/forms@2.0.0-rc.6 wants @angular/common@^2.0.0-rc.6
npm ERR! peerinvalid Peer @angular/platform-browser@2.0.0-rc.6 wants @angular/common@^2.0.0-rc.6
npm ERR! peerinvalid Peer @angular/platform-browser-dynamic@2.0.0-rc.6 wants @angular/common@^2.0.0-rc.6
npm ERR! peerinvalid Peer @angular/router@3.0.0-rc.2 wants @angular/common@^2.0.0-rc.6
And if I am running "npm run typings install" in either the Project folder or Solution folder, then its giving me the following error:
npm ERR! missing script: typings
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <a href="https://github.com/npm/npm/issues">https:
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\aaleem01\Desktop\Calpers834\npm-debug.log
Yes I was following your article only, if you can help me a little bit my friend and can you please help me how can resolve these kinds of problems, I am new to AngularJS 2, please help me my friend.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
modified 7-Dec-16 17:20pm.
|
|
|
|
|
Do you have the proper tools and configuration setup? Have you tried using the latest version of Angular2, Node and NPM?
|
|
|
|
|
Yes I do my friend
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
I need a quick and dirty way to capture information that a person would normally have to type or write into a word document. My challenge is that the person inputting the data needs to be able to key the information online, save the information, print to a pdf/word doc and change the information later.
Is there a quick way to do this? I initially thought using FDF (the old pdf form filler), but i have a few concerns. Any other insights would be greatly appreciated. Thanks.
DrMaltz
"The Code King"
|
|
|
|
|
DrMaltz wrote: Is there a quick way to do this? Not sure what you are looking for. One quick way is to build the page and write the code. What exactly are you looking for?
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
i want to capture information from a user via a webpage, but I want to use something that is highly configurable as the user will want to create different pages to collect information. We have a document assembly program which works great internally, but we need a flexible solution that can work externally. the document assembly program is expensive if we attempt to allow external users to interface with the application so we're trying to find an alternative custom coded program.
DrMaltz
"The Code King"
|
|
|
|
|
Thinking a bit outside the box here, but what about using something like SurveyMonkey? They have a free plan if you just want simple.
|
|
|
|
|
In my old programs, I had a problem with duplicate orders, in which customers forgot that they placed an order and do it twice. With MVC, it looks like an order can be placed twice if you hit the back button.
So I was thinking of implementing like a hash code or something, in which I can use data from the cart, and the shoppers identity to create a code that can be recreated and checked against.
I was looking for ideas on this, or feedback thoughts and what I should use to generate the code.
I copy the cart contents to a order table, but decided to leave the cart items until the order is fulfilled or canceled on the back end this time.
Globalism is Socialism on a planetary scale.
|
|
|
|
|
We have existing two MVC applications and an Angular JS application with individual user accounts using Forms authentication. I have been asked to implement a single sign on mechanism using ASP.Net Identity. I'm very much new these concepts. Kindly help me with this implementation. Thanks in advance.
|
|
|
|
|
Ask old accounts to upgrade their details using the new system. Otherwise use the details provided in database etc. to create their new accounts on new system; ASP.NET Identity.
Asking users will be simple, as you can ask them to re enter the password so that new password policies can be met. Secondly, maybe new system requires a two-way authentication, or email verification and you can do so when they create a new account themselves after trying to login to their accounts using old email.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Hi Afzaal,
Thanks for your reply.
Can you please guide me through the implementation. It's very urgent.
|
|
|
|
|
|
If it's very urgent then google for solutions rather than waiting for people on here to respond as there is a high chance they'll just be googling solutions for you anyway. Identity and SSO are both well documented concepts so there is plenty out there to find.
|
|
|
|
|
Hello,
I develop a web application and I want to print an invoice from this application from button called "Print".
My Question is: How to print the invoice on the local device printer (On client side) and without show the print dialog (Print directly to default printer on the Client device).
Thanks All
|
|
|
|
|