ReBuildAll Blog
Thoughts (mostly) on .NET development

Comments

Re: jQuery validate and the comma decimal separator
Thanks a lot Lenard!

simple and efective solution :)
Konstantin Re: Moving ASP.NET Identity model into another assembly
What changes did you have to make in the accountcontroller.cs?
Lenard Gunda Re: ASP.NET MVC and virtual views
Hi Mohsen,

Thank you for your feedback! I will try to fit in the time to publish the source code for this article sometime in the future.

/Lenard
Mohsen Re: ASP.NET MVC and virtual views
Hi Lenard
Your articles are great but I can't use them!
Is it possible put sample application with download link in your articles?
Lenard Gunda Re: WSDLMerge v1.2
Sorry but it currently does not support password protected web sites. I'll add that to my list of things to do. I currently have very little time to develope the app and that effort is put into fixing issues with wsdl:import element.

Although this should not be hard to implement (you are referring to simple HTTP username/password, right?)
Lenard Gunda Re: ASP.NET MVC and virtual views
Hi Anthony,

I don't think you should use my approach of virtual views to create dynamic menus for users.

You are talking about menus, so I assume you have a repeating list of elements, maybe on multiple levels (sub-menus). I would recommend doing only one view to display your menu structure.

What I would then do in the model or controller, is filter the list based on the role of the user. Maybe even load only those elements (from the datastore) which the current user has rights to.

By including this kind of logic in your Views, you are going against the Model-View-Controller pattern. Your view should be dumb - just display the things it gets. Simple if statements are acceptable or things that affect how things look ("is this a green button or a blue button").

But doing conditional logic that affects WHAT is displayed is something I would leave to the Model itself. The Menu view should already get a filtered list of the items to be displayed.
Lenard Gunda Re: jQuery validate and the comma decimal separator
Andrew, this is an old article. I think I looked at some sort of Globalization support back when I originally wrote it, but did not find it good enough / mature enough. Two years is a long time, I am glad to see better support is now available! Thanks for the contribution. I like how you wrapped the original validators.

I still think this should be wrapped into a plugin or something, so you could just drop it in, and you wouldn't have to manually start registering new validators with globalization support.

andrucci Re: WSDLMerge v1.2
What's about password protected web address (https://localhost/test.svc?WSDL)?
Re: WCF service namespaces (getting rid of tempuri.org)
Thank you
Andrew Gunn Re: jQuery validate and the comma decimal separator
What about the following; proxy both number and range functions and parse value using Globalize (https://github.com/jquery/globalize)...

var _number = $.validator.methods.number;

$.validator.methods.number = function (value, element) {
return _number.call(this, Globalize.parseFloat(value), element);
};

var _range = $.validator.methods.range;

$.validator.methods.range = function (value, element, param) {
return _range.call(this, Globalize.parseFloat(value), element, param);
};
anthony fernandes Re: ASP.NET MVC and virtual views
Very interesting and thank you for the article.
I wanted to use this for creating dynamic menus and needed your advice
Option 1:
If (role==admin)
load partial_view_admin
if(role==user)
load partial_view_user
if(role==agent)
load partial_view_agent
This requires me to create x views for x roles. So this is out

Method 2:

The other approach was to render the menu options dynamically in the partial view

MenuObj = getmenudetailsformdb() /// cache once read from the db
if(role==admin)
menu.show
menu.action = db.action;
menu.controller = db.controller


Method 3:

and the third is the way you have shown in the example above

if(role==admin)
load partial view dynamically for admin from the db and cache the result.

I was wondering if you could help me decide between method 2 and 3 with regards to performance and ease of maintenance. With method 2, I still need to create the menu object from the cache well as in case of method 3, I load the partial view itself from the cache. Hence the confusion.
Please advise.

Thanks!
Re: jQuery validate and the comma decimal separator
Thank you man!
Re: jQuery validate and the comma decimal separator
Damn you saved me some time.
Ty
thanasis Re: jQuery validate and the comma decimal separator
Thanks dude!!
Evert Wiesenekker Re: Extending MVC validation with new rules
Great post and very helpful!
Simone Re: jQuery validate and the comma decimal separator
It's Perfect!!!


Thanks!
Lenard Gunda Re: Merging WSDL and XSD files
Michael Moser1, the download section now has the tool available in binary form. It was also updated just now with some fixes and small feature. Sorry it took so long :)
Lenard Gunda Re: Merging WSDL and XSD files
Brian, if your web serivce has a WSDL schema, it should work with the tool. I have not done work with net.tcp binding, but I assume you can somehow extract the schema in those services as well?
Lenard Gunda Re: Extending MVC validation with new rules
Glad I could help! :)
Re: jQuery validate and the comma decimal separator
Thank you! I've been searching for a solution, but none worked, except yours. Thank you again!
Andrew Stone Re: WCF service namespaces (getting rid of tempuri.org)
Thanks for posting this. It goes a long way helping unwind the WCF insanity. :)
Piotr Re: Extending MVC validation with new rules
Excellent example from the real world.
Exactly what I needed so it saved me some work ;)
Lenard Gunda Re: jQuery validate and the comma decimal separator
To all who thanked me: glad to help.

It is true, that maybe my solution is not ideal. Maybe you should detect the culture setting of the user and use validation that matches that culture setting. Often however, clients want their web application to use a particular culture ALWAYS. When in Finland we have to use the comma in decimal values, regardless of the browser settings of the user. Is this a good idea? I'll let everyone answer that for themselves :)

As a side note, the truth is that software by default is often poorly localized or support for localization is often lacking. That's just my two cents.
Lenard Gunda Re: ASP.NET MVC and virtual views
Kevin, I did not try this with Razor yet, so I cannot say how you would do that.

wirol, I don't understand your question. Validation would work the same way in the views that are served from the database as they would work with regular views?

Andrej, good idea to try with partial views.

Maybe I will revisit the subject given how much time passed since the article was published and add support for Razor and partial views :)
Fernando Re: jQuery validate and the comma decimal separator
Thanks, it´s works fine for me.