Skip to content Skip to sidebar Skip to footer

Why Is Container.DataItem Being Passed As A String Literal?

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 v

Solution 1:

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 Javascript function expects...


Solution 2:

This is the only solution that worked for me: onclick='<%# "chkchange(\"" + Convert.ToString(Container.DataItem["MyId"]) + "\")" %>'


Post a Comment for "Why Is Container.DataItem Being Passed As A String Literal?"