Can somebody explain why the selected event fires but the selection isn't honored

6 posts, 0 answers
  1. Tim
    Tim avatar
    57 posts
    Member since:
    Apr 2011

    Posted 07 Jun 2011 Link to this post

    Hi

    I have a ComboBox that I am using in a Filter Template.

    I get the selection event in my javascript block and can apply the filter.

    However I cann't return to an unfiltered state.

    I notice that even though I get the event, with the correct item the text in the
    combo always revert to 'All', my unfiltered state.

    So I never get a client side notification that will allow me to set NoFilter.

    Help!!!!!! 
  2. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 10 Jun 2011 Link to this post

    Hi Tim,

    Could you explain a bit more the exact implementation of your scenario, since I'm not quite sure what is the problem you are experiencing.

    Any additional information provided would be helpful.

    Best wishes,
    Dimitar Terziev
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. Tim
    Tim avatar
    57 posts
    Member since:
    Apr 2011

    Posted 10 Jun 2011 Link to this post

    Hi Dimitar

    Sure I can give you some more info.

    I have a RadGrid that has two columns that display images only.

    In order to get filtering to work I have to place ComboBoxes in the FilterTemplate of each column.

    I populated one of these combos with 4 state values:
        Text="All"                    Value="-1"
        Text="Unassigned"     Value="1"
        Text="Assigned"         Value="2"
        Text="In progress"      Value="3"

    I then wrote a client side event handler for each combo that would fire on a selection change.

    In those event handlers I obtained the combobox item's value attribute.

    Here's the event handler code for one of the combos.
     
              var tableView   = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
              var value       = args.get_item().get_value();

              
              // This is just to show the event handler fired, and that I have the expected value. 
              alert( value.toString() );

                                                                
              if ( value < 0 )
              {
                    tableView.filter( "StateUnique", value , "NoFilter" );
              }
              else
              {
                    tableView.filter( "StateUnique", value , "EqualTo" );
               }

    The 'All' item is the default, and that appears in the input area of the combo on initial page load.

    I then make a selection, for instance 'Unapproved'.

    While the code is stopped at the alert I see 'Unapproved' in the input area of the combo.
    So clearly the client side event fired, and I can tell from the alert that I have a value of 1.

    So far so good.

    I respond to the alert and can tell from a break-point in my code behind that a post-back occurs.

    The grid gets filtered just fine.

    However after the post-back the combobox input area is set back to 'All'.

    So I can never get a selection change event to fire when I click the 'All' item in the combo dropdown area.

    I have read several articles on your web-site that indicate the following:

    I am including the process I went through so you understand the problems I've had and so will others.
     
    1. Combos remember their state across Post-backs IF you have ViewState enabled on the page AND the control.
        Also you have to set ViewStateMode = Enabled.
        This doesn't cause the combos to remember their state in my scenario.
        Am I missing something?
        I even enabled ViewState on my parent grid.

    2. I found an example in your on your website @
    http://demos.telerik.com/aspnet-ajax/grid/examples/programming/filteringtemplatecolumns/defaultcs.aspx

    This example finally gave me a solution that worked, but required me to sub-class the grid columns.
    However I went ahead and implemented this, although it seemed more involved than I would have liked.
     
    3. Finally I stumbled across a different example @
    http://demos.telerik.com/aspnet-ajax/grid/examples/programming/filtertemplate/defaultcs.aspx
    This gave me the solution I prefer.
    Add the following to the definition of my comboboxes:

     

     

    SelectedValue

     

     

    ='<%# ((GridItem)Container).OwnerTableView.GetColumn("StateUnique").CurrentFilterValue %>'

    Obvious the column name is different for each of my columns.

     

     

     

     

     

     

     

    For some reason I can only get this to work in my code if I add the ComboBox Items in my aspx file,
    rather than dynamically, but I expect that is a coding error on my part.

    HTH
     

  4. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 15 Jun 2011 Link to this post

    Hello Tim,

    Since we have been discussing a similar problem in this forum thread here, is this the same issue or it's a different one?

    All the best,
    Dimitar Terziev
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  5. Tim
    Tim avatar
    57 posts
    Member since:
    Apr 2011

    Posted 15 Jun 2011 Link to this post

    Hi Dimitar

    Yes it is most definitely the same issue.

    I think I have a resolution.

    I merely attempted to document my process of discover in my last message,
    so the people viewing the thread would understand what was involved
    AND to point you to the solution I finally settled on for your future reference.

    HTH
  6. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 20 Jun 2011 Link to this post

    Hello Tim,

    It would be helpful, if you could share your solution so others could use it as a reference point.

    Greetings,
    Dimitar Terziev
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top