Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OnclientClick Databinder.Eval problem

Status
Not open for further replies.

daveonion

Programmer
Aug 21, 2002
359
GB
Hi,
I have a javafunction which I am trying to pass a parameter using databinder.eval onclientclick of a button in a gridview, however i cant seem to get the correct syntax.

See below

OnClientClick= 'return confirmClose("<%#Databinder.Eval(Container.DataItem, "Recieved")%>");'

Please advise if its possible or not

thanks
 
i think you mean javascript, not java. completely different:)
is Received a string or boolean? if it's a string it needs to be in quotes (single or double), if it's a number or boolean then you don't need quotes on the client (javascript) side. for example
Code:
OnClientClick= 'return confirmClose(<%#Databinder.Eval(Container.DataItem, "Recieved")%>);'
you could also try using an equals, instead of a a pound sign
Code:
OnClientClick= 'return confirmClose("<%=Databinder.Eval(Container.DataItem, "Recieved")%>");'
a third option. build the entire string on the server
Code:
OnClientClick= '<%=string.Format("return confirmClose('{0}');", Databinder.Eval(Container.DataItem, "Recieved"))%>'
I believe on of these approaches should work. It's been a long time since I had to deal with webforms, so my syntax may be off.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top