Server onbuttonclick only firing once

11 posts, 0 answers
  1. Sean
    Sean avatar
    13 posts
    Member since:
    Jan 2009

    Posted 10 Feb 2009 Link to this post

    Hi,

    I have the following RadToolBar within a user control :
       <telerik:radtoolbar id="rtbToolBar" runat="server" skin="Office2007" borderstyle="None" 
          width="100%" onbuttonclick="rtbToolBar_ButtonClick" onclientbuttonclicking="toolbarClicking">  
                                  </telerik:radtoolbar> 

    Buttons are then added programatically.

    The problems is, the serverside button click event only fires the first time that a button is clicked.  After that, nothing happens.
    The clientside onclientbuttonclicking event still fires.
    As a test I have placed an asp button in the control with the radtool bar.  The buttons click event fires succefully each time.

    I would very much appreciate some help with this issue, it's driving me crazy!

    Thanks,

    Sean Duffy
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 10 Feb 2009 Link to this post

    Hello Sean,

    I tested ButtonClick event and wasn't able to reproduce this issue - it fires as expected.

    Regards,
    Yana
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sean
    Sean avatar
    13 posts
    Member since:
    Jan 2009

    Posted 12 Feb 2009 Link to this post

    I am still experiencing the problem described.  Unfortunately this issue is of such a serious nature that if we are unable to resolve it, we may be unable to use the Telerik controls and therefore it would not be worth purchasing the full license.

    In detail, this is the problem we are experiencing.

    As previously described,  we have the following RadToolBar within a user control.
    This control is added to the MasterPage.

    <telerik:radtoolbar id="rtbToolBar" runat="server" skin="Office2007" borderstyle="None"  
          width="100%" onbuttonclick="rtbToolBar_ButtonClick" onclientbuttonclicking="toolbarClicking">   
                                  </telerik:radtoolbar>  

    We are then adding a range off buttons :

    rtbToolBar.Items.AddRange(ToolbarHelper.GetButtonsForView(OwnerType.ToString())); 
    (GetButtonsForView returning List<RadToolBarItems>)

    If the OwnerType of the toolbar changes, then we call :

     rtbToolBar.Items.Clear(); 

    before adding the next range of buttons in the manner described previously.

    After this point, the buttons within the ToolBar no longer generate server post backs.
    If you require more information, then please let me know.

    Regards,

    Sean Duffy





  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 16 Feb 2009 Link to this post

    Hello Sean,

    I tested the provided code and still am not able to observe this issue. I've attached my test page, please download it and give it a try. What is different in your case? Could you modify it and send it back? You should open a support ticket in order to attach files. Thanks

    Regards,
    Yana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Cristian Malinescu
    Cristian Malinescu avatar
    13 posts
    Member since:
    May 2010

    Posted 15 Jun 2010 Link to this post

    I experience the same problem; the provided sample uses an aspx page BUT the problem mentions that the context of the error is an ascx user control - this is the same context I experience it. This is my code

    ascx user control:
         <telerik:RadToolBar id = "_X_ToolBar_"                                                            
                             OnButtonClick = "_X_ToolBar_Click"                         
                             Width = "100%" runat="server"
           <Items> 
             <telerik:RadToolBarButton IsSeparator = "true" runat="server"/> 
                               
             <telerik:RadToolBarButton ImageUrl = "~/Images/16x16/plain/save_x.png"  
                                       ToolTip = "Save selected X" 
                                       Text = "Save" 
                                       Value = "Save" 
                                       CommandName = "Save" /> 
                                             
             <telerik:RadToolBarButton IsSeparator = "true" runat="server"/>                                         
           </Items> 
         </telerik:RadToolBar>                        

    ascx code behind:
      Protected Sub _X_ToolBar_Click(ByVal sender As ObjectByVal e As RadToolBarEventArgs) 
        Dim item As RadToolBarItem = e.Item 
        Dim value As String = item.Value 
     
        If Flow.Save.ToString.Equals(value) Then 
          SaveX() 
        End If 
      End Sub 

    _X_ToolBar_Click(...) method does not get fired - ever.
     
  7. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 16 Jun 2010 Link to this post

    Hello Cristian,

    Can you tell us how you load this user control in the page? If it's loaded dynamically, it should be added on every postback with the same id. Please check this and let us know the result.

    Greetings,
    Yana
    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.
  8. Cristian Malinescu
    Cristian Malinescu avatar
    13 posts
    Member since:
    May 2010

    Posted 16 Jun 2010 Link to this post

    Thanks Yana; so the scenario is like this:
    - In one aspx page I have a RadSplitter with two zones - left and right, both being RadPane containers.
    - The left RadPane contains a RedTreeView I call the *model navigator*; each element of the tree can represent a different 
      model part depending on the hierarchy level.  
    - Selecting in the navigator tree one node triggers a server side callback for the OnNodeClick event.
    - In the callback, the right model is identified based on the node hierarchal level and the right entity is instantiated based on the identifier stored in the node.
    - Now, in the right RadPane I call the model workspace it is supposed to load dynamically the presentation template of the corresponding model part. Each model part has its own presentation template defined as an user control/ascx component.
    The aspx code doing it looks this way

           Protected Sub _X_TreeView_NodeClick(ByVal sender As ObjectByVal e As RadTreeNodeEventArgs)  
              If e.Node IsNot Nothing Then 
                If GetType(X).ToString().Equals(e.Node.Category()) Then 
                  Dim x_ As X = New X()  
                  convertFromTreeNode(x_, e.Node)  
                  loadXTemplate(x_)  
                End If 
              End If 
            End Sub 
              
            Private Sub loadXTemplate(ByRef x_ As X)  
              If x_ IsNot Nothing Then 
                Try 
                  Dim t_ As XTemplate = DirectCast(LoadControl(XTemplate.Meta.URL), XTemplate)  
                      
                  If t_ IsNot Nothing Then 
                    _XTemplate_Frame_Pane_.Controls.Add(t_)  
                  End If              
                Catch ex As Exception  
                  log(ex)  
                  Throw ex  
                Finally 
              End If 
            End Sub       
             

    Now, the model template has its own actions triggered from a RadToolBar belonging to the ascx template - not the owning aspx page, and the action callback is defined into the ascx code behind as a callback attached to the toolbar OnButtonClick event. When one action of the toolbar gets triggered it is first intercepted by the _LOAD handler of the owning aspx page but it doesn't get chained to the declared toolbar callback.

    Is there a better a way to make the RadPane controls collection - maybe a better flow, to keep aware of the control added dynamically? I noticed the controls collection gets emptied after clicking one toolbar button in the template; the problem is that in _PreInit, _Init, _Load stages of the owning aspx page there is no way - as far as I could find, to discover/identify which element of the tree got selected so that I can be proactive and load the right template; this information gets revealed only at the stage when the treenode click handler is executed in the flow.

    Cheers,
    Cris

  9. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 22 Jun 2010 Link to this post

    Hello Cristian,

    As I explained earlier dynamic controls should be added on every postback - this may be the reason that the event is not fired. I've attached a simple page and 2 simple user controls based on your description to show you that the event is fired without a problem. Please download the example and examine it.

    Greetings,
    Yana
    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
  10. Cristian Malinescu
    Cristian Malinescu avatar
    13 posts
    Member since:
    May 2010

    Posted 22 Jun 2010 Link to this post

    I agree as I know this for long time - and I used it this way. What I expected from Telerik as a framework is to go behind the default platform features and lifecycle - at the end it is a framework and not only a decorator layer on top of the platform defaults, and provide an API attached to the RadPane - I think most people expect it to be like this where eventual dynamically added content becomes known to the owner widget and integrated into its lifecycle and state; otherwise it is nothing else but pure text injection the client/consumer API has to take care of it always - so, the question is then, why use anymore RadPane when the same can be achieved with div, css and JQuery?! If this state and lifecycle integration is indeed supported by RadPane – I couldn’t find it into any of the API reference provided by Telerik – maybe someone can point to it or put an example in the control examples page? For a presentation framework supposedly meant to support dynamic web applications it is crucial to provide widgets able to integrate one with another in a flow graph and lifecycle otherwise these widgets are nothing else but tiny text renderers with a limited state management defaulting always to the platform one. For achieving this simple text rendering with enclosed state management just light template solutions are much more efficient, like for exmaple http://www.stringtemplate.org/.

  11. T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 23 Jun 2010 Link to this post

    Hi Cristian,

    Thank you for sharing your feedback with us.

    The goal of RadControls for ASP.NET AJAX is not to construct a separate framework of our own, but to provide ready-to-use components for the ASP.NET AJAX Framework. We try to improve it and build upon it with controls like RadAjax, RadScriptManager and RadStyleSheetManager, but we can't change any of it basic principles. The relatively complex control lifecycle is such fundamental part of the framework.

    You're, of course, free to mix RadControls with any other server-side or client-side techniques to achieve your goals. We can even recommend using ASP.NET MVC and our excellent extensions for it in order to achieve more fine grained control.

    I hope this helps.

    Regards,
    Tsvetomir Tsonev
    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
  12. Cristian Malinescu
    Cristian Malinescu avatar
    13 posts
    Member since:
    May 2010

    Posted 23 Jun 2010 Link to this post

    Thank you Tsvetomir - this is the answer I was looking for driving further our development requirements and measure the amount of support Telerik RadControl framework can offer us. In this case, maybe we will look into the additional Telerik frameworks to plug together with RadControls for getting a better bang.

    Cheers,
    Cris

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017