views:

141

answers:

2

I have a colleague who thinks this

alert('<asp:Localize ID="ErrorAddingComponent" runat="server" Text="There was an error adding component: "  meta:resourcekey="ErrorAddingComponent"/>' + errortext);

is a good idea if we get an error from an AJAX call, the errortext is the parameter of the function called on error from a jquery ajax,

to me the thought of using a server side localize control seems horrible, we are using asp.net MVC so, for me, even using the GetLocalResourceObject is prefereable to this,

can anyone give me any reasons I can raise this with him? (or if you believe his solution is ok why?).

As an aside the alert annoys me too, I believe we should parse errors to a div for presentation.

+3  A: 

alerts = -1

a div is nice, and not annoying, plus, you can offer multiple solutions, links as, try again, or ignore, or start over.

If you use an alert, it looks ugly, and you only provide limited options to the user.

FrankBr
I like the explanation of how we can use the div to provide alternatives, the alert is just ugly!
Pharabus
A: 

Are you trying to put a server side control in a client side alert box?

janzi
I'm not trying to do anything, just code checking someone else code. But yes, the localize would parse a string so if the alert fires the message would show. It is bad in my opinion, I just cant formalise a response as to why!
Pharabus