I have configured a GridView to fill data by an ObjectDataSource. This ObjectDataSource requires only one parameter which is bound to a DropDownList. This all works well.
When i load the page, it fills the DropDownList and whatever field is displayed in this DropDownListis passed as a parameter to the ObjectDataSource which further fills the GridView.
Now, i want to enhance the functionality and have a TextBox and Button next to this DropDownList. I want to give my user the option to either select a value from the DropDownList, OR TYPE IT IN THE TextBox AND PRESS ENTER TO UPDATE THE GridView.
Any idea how to do it?
I have tried dataSource.Selecting event. but it isn’t working the way i want it to be.
please help
This is a rough sample but basically what you can do is instead of creating a control parameter you can create a session parameter or something similar:
So when you click enter it will use the textbox value or when you change the dropdownlist it will use the dropdownlist’s value.
You can also have radio button’s giving the user the option to specify from where he want’s the value.
Code Behind:
EDIT AFTERTHOUGHT
You can also instead of assigning the parameter to a session field, just set the objectdatasource’s parameter directly (Barring Exception handling).