This is a migrated thread and some comments may be shown as answers.

GridBoundColumn and Filtering

6 Answers 132 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kalyan
Top achievements
Rank 1
Kalyan asked on 13 Sep 2010, 09:36 PM
Hi Telerik Team,

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

Sort by
0
Accepted
Mira
Telerik team
answered on 14 Sep 2010, 10:56 AM
Hello Kalyan,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kalyan
Top achievements
Rank 1
answered on 14 Sep 2010, 02:17 PM
Hi Mira,

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

0
Kalyan
Top achievements
Rank 1
answered on 14 Sep 2010, 04:17 PM
Hi Mira,

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
0
Kalyan
Top achievements
Rank 1
answered on 14 Sep 2010, 06:10 PM

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




0
Accepted
Mira
Telerik team
answered on 15 Sep 2010, 10:00 AM
Hello 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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kalyan
Top achievements
Rank 1
answered on 15 Sep 2010, 01:30 PM
Thanks for your support! It works great!!
Tags
Grid
Asked by
Kalyan
Top achievements
Rank 1
Answers by
Mira
Telerik team
Kalyan
Top achievements
Rank 1
Share this question
or