Comments
Latest 25 comments as RSS feed |
Latest 25 comments as Atom feed
@Sergey, have to look into that. I think it might be just a configuration thing. Which version of IIS are you trying to get this to work with?
@Marco Leo, I am not sure you can remap the location of the web.config file, especially since it contains vital information for IIS as well (if you are using IIS7 or later). While I have not confirmed this, I think that you cannot remap web.config. Have to do some digging to make sure.
@Marco Leo, I am not sure you can remap the location of the web.config file, especially since it contains vital information for IIS as well (if you are using IIS7 or later). While I have not confirmed this, I think that you cannot remap web.config. Have to do some digging to make sure.
It seems that it doesn't work with IIS, however everything is fine with WebDev server. Do you have any thoughts what could be wrong? Thanks.
Sensational!
I´m from Brazil and I searched for this kind of solution during a entire day!
I researched for Custom Binding, change the .js manually, change the Decimal fields to String and populate the Decimal on the property´s setter...
I did´t found a globalization version for this js library, so, I think this is the best solution.
At line 4 of the range validation, I suggest another change to solve validation when using "." to thousand separator:
----------
var globalizedValue = value.replace(".", "").replace(",", ".");
----------
And with we associate this with a mask, we have a nice masked and validated number and currency validation:
http://www.jquerypriceformat.com/
Thank you.
I´m from Brazil and I searched for this kind of solution during a entire day!
I researched for Custom Binding, change the .js manually, change the Decimal fields to String and populate the Decimal on the property´s setter...
I did´t found a globalization version for this js library, so, I think this is the best solution.
At line 4 of the range validation, I suggest another change to solve validation when using "." to thousand separator:
----------
var globalizedValue = value.replace(".", "").replace(",", ".");
----------
And with we associate this with a mask, we have a nice masked and validated number and currency validation:
http://www.jquerypriceformat.com/
Thank you.
Hi thanks a lot for the article but in my app is not working I am using jQuery Validation Plugin 1.8.0
Do you know how to solve it in this case?
Do you know how to solve it in this case?
hello @Lenardg, I found your post really interesting and I tried to implement a similar version but in my case I just wanted to Load views from another File system location outside the web-app, without zips.
Everything works almost fine
, I am having same problem with the web-config of the view. Now my application want to get the web-config in the virtual path under the web-app root instead of my Virtual path remapped root. And for same reason it can't resolve same css files too.
I hope you can help me and future people with the same problem.
Thank again for your post i found it really useful.
Marco Leo
Everything works almost fine
, I am having same problem with the web-config of the view. Now my application want to get the web-config in the virtual path under the web-app root instead of my Virtual path remapped root. And for same reason it can't resolve same css files too.
I hope you can help me and future people with the same problem.
Thank again for your post i found it really useful.
Marco Leo
Thanks brother
I had two days with the error of the blessed coma.
lol that is the problems of Latin countries.
I had two days with the error of the blessed coma.
lol that is the problems of Latin countries.
@Tom, glad you found my post useful. I think it possible to serve views from wherever you want them to be, be it ZIP files, databases or assemblies. Although assemblies might be tricky, because they are also loaded by ASP.NET, but before loading they are copied over to the temporary asp.net files folder. I myself have not tried your approach, so I do not know if there could be some sideeffects there.
But I think your problem might be in the override of GetCacheDependency(). My implementation checks if the file was served from the .ZIP file, and then it creates the cache dependency itself, specifying the .ZIP file as the object to monitor.
I think you should there specify the .DLL file (assembly) you pulled the view out of. From the error you are getting I think you are calling the base implementation, which tries to monitor your view and fails - of course, since the view itself does not exist on disk.
But I think your problem might be in the override of GetCacheDependency(). My implementation checks if the file was served from the .ZIP file, and then it creates the cache dependency itself, specifying the .ZIP file as the object to monitor.
I think you should there specify the .DLL file (assembly) you pulled the view out of. From the error you are getting I think you are calling the base implementation, which tries to monitor your view and fails - of course, since the view itself does not exist on disk.
Thank you for your post. Your approach is exactly what I'm looking for, however, I would like the virtual views to reside in a different assembly. I have a "core" assembly that gets re-used across projects. I would love to be able to put re-usable views in the "core" assembly, then use your approach to pull the views when needed. I've tweaked your process to look for views in an assembly, but it fails. I keep getting the following error:
Directory 'C:\ProjectStore\xxx\xxx\xxx.Admin\Views\Person' does not exist. Failed to start monitoring file changes.
Is it possible to pull views from a different assembly? My goal is to have a single location for re-usable views.
Thanks agian for your post and insight.
Directory 'C:\ProjectStore\xxx\xxx\xxx.Admin\Views\Person' does not exist. Failed to start monitoring file changes.
Is it possible to pull views from a different assembly? My goal is to have a single location for re-usable views.
Thanks agian for your post and insight.
Thanks for the comments @Deef, @ruben. I updated the post to reflect this change (and I also updated my code where I used this
)
@Vince, are you sure you include the correct version of the validate .js file? MVC project template includes both the regular version and the minified version. If you modified the regular version but include the minified version (which is recommended) your modification might not take effect.
)
@Vince, are you sure you include the correct version of the validate .js file? MVC project template includes both the regular version and the minified version. If you modified the regular version but include the minified version (which is recommended) your modification might not take effect.
I agree with Ruben, you should not change the original file in this case (or any other for that matter). Very dangerous if you or someone lese upgrades/updates that file later on and forgets about that change.
One thing is obvious, the MVC team 'forgot' about everyone outside the US.
One thing is obvious, the MVC team 'forgot' about everyone outside the US.
To avoid having to put the namespace information on every single DataContract, you can optionally put an overall ContractNamespace on the whole class:
[assembly:ContractNamespace("http://myservice.com/", ClrNamespace = "MyService")]
Look it up to find more examples.
[assembly:ContractNamespace("http://myservice.com/", ClrNamespace = "MyService")]
Look it up to find more examples.
The validate for comma's doesn't work. I replaced it in the validate javascript and it does not work.
@Leniel Macaferi, glad to help.
@ruben, thanks for the info, I will have to look into that jQuery globalization stuff. I know I should not modify the .js files directly, but I was in a hurry and did not find anything useful fast enough. Documentation is very much missing IMHO
@ruben, thanks for the info, I will have to look into that jQuery globalization stuff. I know I should not modify the .js files directly, but I was in a hurry and did not find anything useful fast enough. Documentation is very much missing IMHO
Much better is to use jquery globalization in this case 2 files are need
jquery.global.js and jquery.glob.pt-BR.js).Then all you need is this code in your page:
//Function which validates range
$.validator.methods.range = function (value, element, param) {
var newValue = value;
return ($.global.format(newValue, 'n') >= $.global.format(param[0], 'n') && $.global.format(newValue, 'n') <= $.global.format(param[1], 'n'));
}
jquery.global.js and jquery.glob.pt-BR.js).Then all you need is this code in your page:
//Function which validates range
$.validator.methods.range = function (value, element, param) {
var newValue = value;
return ($.global.format(newValue, 'n') >= $.global.format(param[0], 'n') && $.global.format(newValue, 'n') <= $.global.format(param[1], 'n'));
}
There is a little mistake...You shouldnt change the original code of jquery.validate file.Much better is to add follow code to your page,which replace validator methods of jquery.validate:
$.validator.methods.range = function (value, element, param) {
var newValue = value;
for (var i = 0; i < value.length; i++) {
if (value.charAt(i) == ',') {
newValue = value.replace(',', '.');
break;
}
}
return (newValue >= param[0] && newValue <= param[1]);
}
$.validator.methods.range = function (value, element, param) {
var newValue = value;
for (var i = 0; i < value.length; i++) {
if (value.charAt(i) == ',') {
newValue = value.replace(',', '.');
break;
}
}
return (newValue >= param[0] && newValue <= param[1]);
}
Hi Lenard,
I faced the same problem here in Brazil where we use ( , ) as a decimal separator.
Thanks for sharing this useful info that helped me to fix the problem.
Regards,
Leniel
I faced the same problem here in Brazil where we use ( , ) as a decimal separator.
Thanks for sharing this useful info that helped me to fix the problem.
Regards,
Leniel
There is a small error in the code...
The line 4 of the range fix must be:
var globalizedValue = value.replace(",", ".");
[]s!
The line 4 of the range fix must be:
var globalizedValue = value.replace(",", ".");
[]s!
@Brian,
Are you using IIS hosting or the VS development web server? Or perhaps IIS Express?
I created this example some while back, but created a new one with .zip files that I published yesterday. As I was testing that (the .zip version) I specifically used features like ViewBag to verify functionality was not lost. Have you tried running that example? You can download that in source code format as well.
Are you using IIS hosting or the VS development web server? Or perhaps IIS Express?
I created this example some while back, but created a new one with .zip files that I published yesterday. As I was testing that (the .zip version) I specifically used features like ViewBag to verify functionality was not lost. Have you tried running that example? You can download that in source code format as well.
The loading part works great, but when the view executes, it can't find Razorish concepts like ViewBag.
The name 'ViewBag' does not exist in the current context
Any suggestions?
The name 'ViewBag' does not exist in the current context
Any suggestions?
Now you can also check out another VirtualPathProvider example by me that uses .zip files for storage.
@Jayakumar,
You probably wanted to ask me about the working code? I don't know if I have the original code stored that I used for this article. If I can find it, I will try to post it online.
You probably wanted to ask me about the working code? I don't know if I have the original code stored that I used for this article. If I can find it, I will try to post it online.
Hi Khalid, nice article, is there any you can give us working project as an attachment with this article please?
Thank you
Thank you
Hi,
I am also stuck in the same problem. Please check the problem steps here: http://forums.asp.net/t/1642934.aspx
Kindly suggest me a solution, if any.
I am also stuck in the same problem. Please check the problem steps here: http://forums.asp.net/t/1642934.aspx
Kindly suggest me a solution, if any.
