2014年7月13日 星期日

[RESOLVED] Problem in detailsview edit for cascading dropdownlist


I have created two dropdown lists.


The 2nd DDL depends for values on the 1st DDL.


I have written code on the SelectedIndexChanged event of 1st DDL to change values of 2nd DDL.


also i have used detailsview.


In the template field i have used 2 DDL mentioned above.


they are having SelectedValue='<%# Bind("") %>' property.


Everything works fine but when i tried to edit record in detailsview & select value from 1st DDL


then it gives me following error.






Server Error in '/' Application.



Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.


Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.




Exception Details: System.InvalidOperationException: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.





Please help me in editing the detailsview with cascading dropdown list having bind property.


Thanx in advance.



you can bind from Serverside Code and bind the Selected Value

at the runtime of the DetailView Event name ItemDataBound.






Without your codes, it's hard to tell your error's reason.


But I guess you can see this and the answer:
http://csharpdotnetfreak.blogspot.com/2009/03/populate-dropdown-based-selection-other.html
 



ml123_me states that a DetailsView control is being used, whereas the answer link given is in a manually created table.  There are countless postings on the differences of behavioiur between these two; I myself came onto this article as this works fine for
me outside of a DetailsView, but results in the error message inside of a DetailsView.  Sadly no solution yet.  BUMP!


沒有留言:

張貼留言