I have a custom class that inherits from GridBoundColumn
I have overridden SetupFilterControls method and I am able to have a dropdown and able to bind value to the dropdown.
The dropdown contains username as textfield and UserID as value field.
Also I am able to fire the SelectedIndexChanged event - The code on the selected Indexed event is as follows
GridFilteringItem filterItem = (sender as RadComboBox).NamingContainer as GridFilteringItem;
RadComboBox ddList = filterItem["ResourceNames"].Controls[0] as RadComboBox;
if (ddList.SelectedValue == "All")
filterItem.FireCommandEvent(
"Filter", new Pair(GridKnownFunction.NoFilter.ToString(), this.UniqueName));
else
filterItem.FireCommandEvent(
"Filter", new Pair(GridKnownFunction.EqualTo.ToString(), this.UniqueName));
The command on the else part of the above thing is fired when I select a user name from the dropdown.
then the code where the grid set to the datasource is executed
MyGrid.DataSource = BusinessLayer.GetAllTasks(projID)
However no rows on the grid are returned. it returns 0 rows.
How to make this work?
I am planning to rebind the grid by ensuring the filtered value is passed. How can I ensure that the value I selected on the dropdown is passed to GetAllTasks(ProjID) method so that I can manually filter the result set.
6 Answers, 1 is accepted
I have followed your scenario and prepared a sample project for you demonstrating how the desired functionality can be achieved. You can find it attached to this post.
However, I recommend that you use the Filter Templates feature of the RadGrid to implement your scenario.
I hope this helps.
Regards,
Mira
the Telerik team
Thanks for your support!
I am not able to make the sample code to work.
MyStuff.MyCustomFilteringColumn is not working as (are you missing a using directive or an assembly reference?)
It seems like everything else is correct. I commented that line of code and I am able to resolve MyStuff.MyCustomFilteringColumn on the immediatewindow of the visual studio any pointers would help.
I can try the filter template you have mentioned as a alternate approach(pending approval from my PM)
I also wanted to mention that we use Linq To Sql and Server side binding of data.
It could be great, if you can help me with both the approach ( with and without filtertemplate)
Kind Regards,
Kalyan
Thanks I made the sample work and looked into the code. Now it is working. I appreciate your support.
I am marking your reply as the answer.
Once again, thanks!
Kind Regards,
Kalyan
Hi Mira,
I have encountered one small issue though, I am not able to insert a value into the combobox.
list.Items.Insert(0,
new RadComboBoxItem("All","All")); doesn't seem to work.
How do I insert values on the gridboundcolumn radcombobox?
I am writing the above code and then I bind the list to the datasource.
Kind Regards,
Kalyan
Please try setting the AppendDataBoundItems property of the corresponding RadComboBox to true and let me know whether it helps.
Best wishes,
Mira
the Telerik team