Ayende @ Rahien

It's a girl

Code smell

Why does it have to be like this?

if($F('<%= PolicyDescription.ClientID %>')==

    '<asp:Literal runat="server" Text="<%$ Resources:PolicyResources, DescriptionNotFound %>"/>')

{

    alert('<asp:Literal runat="server" Text="<%$ Resources:PolicyResources, EnterValidPolicyNumberOrDescription %>"/>');

    return;

}

 

Comments

Sergio Pereira
03/26/2007 06:00 PM by
Sergio Pereira

I see your point... Looks ugly no matter what; but at least it can be made less verbose if you add a helper method in you page class (hopefully a common base class):

protected string R(string policyResName)

{

//figure this code out :)

return phrase;

}

And your script could be reduced to:

if($F('<%= PolicyDescription.ClientID %>')==

'<%=R("DescriptionNotFound")%>' ) 

{

alert('<%=R("EnterValidPolicyNumberOrDescription") %>'); 

return; 

}

Comments have been closed on this topic.