views:

36

answers:

1

I'm trying to pass a string value to a javascript function from a LinkButton's OnClientClick event, but the function is receiving "<%# Container.DataItem %>" instead of the value. Here's the code:

OnClientClick="javascript:SaveQuotaGroupCode('<%# Container.DataItem %>');"

The container is a collection of strings. Why is it not evaluating?

EDIT: This is located in a nested ListView. The datasource for the inner ListView is a property in the datasource of the outer ListView.

+2  A: 

OnClientClick="javascript:SaveQuotaGroupCode('<%# Eval("YourProperty") %>');"

Also, the collection should be transformed into a comma separated list of values as that is what the signature of the javscript function expects...

Alexander
I thought Container.DataItem represented the current bound data? The ListView is bound to a string collection property. I edited the question to include that this is inside a nested ListView. No matter what I try it passes everything in the script tags as a literal. Also, the evaluation I'm using works for the Text property.
kirk.burleson