Click here to Skip to main content
15,035,600 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<asp:DropDownList ID="ddlStatus" runat="server" onchange="ChangeStatus(<%#Eval("TotalPrice") %>)">

getting an error in this :(
JoCodes 9-Oct-13 6:44am
Where are you using the dropdownlish? Can you please elaborate on the error and the scenario which you have?
CodeBlack 9-Oct-13 7:33am
can you show mw your code of dropdown binding ?

1 solution

Try modifying you code like below

onchange=<%# Eval("TotalPrice", "ChangeStatus({0});") %>

Hope this helps
Aswathi Narayan 9-Oct-13 7:20am
Thank you for ur reply.. this one is working .. but am getting an error like this

Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
JoCodes 9-Oct-13 8:16am
Are you using dropdownlist inside a gridivew? The Eval method uses the name of a data field ( TotalPrice) and returns a string value of that field from the current record inside given data source.
Aswathi Narayan 11-Oct-13 5:53am
ya.. dropdown list in a datalist
JoCodes 9-Oct-13 8:20am
Can you post code how its binding using a datasource through which you are fetching the TotalPrice Field.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900