The following works great:
OnClientClick='<%# Eval("UserName", "return confirm(\"Delete the user
{0}?\");") %>'

But I need to do this with a resource and the following does not work:
OnClientClick='<%# Eval("UserName", "<%$ Resources:Windward, Admin_Confirm
%>") %>'

How can I accomplish this?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm

RE: resource in OnClientClick by stcheng

stcheng
Tue Oct 17 03:32:33 CDT 2006

Hello Dave,

The problem here is that we can not use nested inline expression in aspx
template. Both <%# %> and <%$ %> are top level expression.

For your scenario, you can actually define a custom helper function for
retrieve resource value from resource file. The ASP.NET 2.0 page class
provide "GetLocalResourceObject" and "GetGlobalResourceObject" to
programmatically retrieve resource value from local or global resource
files. They can replace the <%$Resource .... %> expression. See the
following msdn reference:

#How to: Retrieve Resource Values Programmatically
http://msdn2.microsoft.com/en-us/library/ms227982.aspx

So your final code can be changed to below style:


OnClientClick='<%# Eval("UserName",
ResourceHelper("Windward","Admin_Confirm")) %>

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.