Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Sample table to explain the problem (EmployeeID,EmployeeName,ManagerID)

In my item template of my gridView I have a dropDownList which binds as follows:

When you choose dataSource I set EmployeeName to be the field that is being displayed and the EmployeeID for the value. Then in the Edit bindings the selectedValue is the ManagerID.

The result of this for every EmployeeName I get to see the ManagerName.

The question:

After I perform an insert I am trying to apply a SqlDataSource.FilterExpression however an error is thrown saying that the value of the dropDownList is not found in the list? The FiterExpression is on the EmployeeID which is equal to the newly inserted ID.

I created another sqlDataSource with the same select command as source one just to test out the filter after the insert and it actually gave me a correct result.

I played around with sqlDataSource.databind() and gridView.databind() but it seems I am not able to figure out why is it working with source 2 and not in source 1? probably positioning of binding?

Thank you
Posted

1 solution

4277480 wrote:
After I perform an insert I am trying to apply a SqlDataSource.FilterExpression however an error is thrown saying that the value of the dropDownList is not found in the list?


Did you updated the dataset after the insert? It looks like the filter is workin on the old data and not able to find the new data entered. Try updatting/re-fetching the data for grid bind and apply filter.
 
Share this answer
 

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