CommandName="Update" requires OnButtonClick

24 posts, 0 answers
  1. Jon Stromer-Galley
    Jon Stromer-Galley avatar
    15 posts
    Member since:
    Aug 2007

    Posted 02 May 2008 Link to this post

    Is it a bug that I have to include (at least) an empty event handler to have the default behavior for

    CommandName="Update" and the other "built in detailsview commands"?

  2. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 05 May 2008 Link to this post

    Hi Jon,

    This behavior is by design - we made the RadToolBar control similar to the navigation controls (RadTreeView, RadMenu, etc). We are still considering if to change it to always perform a postback unless its PostBack property set to false, which might be the better decision for this type of control.

    We'd really like to know your opinion on that, guys!

    Thanks,
    Erjan Gavalji
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jon Stromer-Galley
    Jon Stromer-Galley avatar
    15 posts
    Member since:
    Aug 2007

    Posted 07 May 2008 Link to this post

    Hi Erjan,

    Love the control set by the way.  Now that I know one needs an empty handler in the code behind, it is no big deal to include it.

    When I saw that one could use CommandName="" in the toolbar I was expecting behavior more like an asp:button where one does not need a handler if one was using a "standard" CommandName like "Update" or "Insert".

    Perhaps, adding the control to a form could automatically add the empty handler as well with a comment indicating why it was automatically added would keep the current functionality but I would not have been confused.

    Best wishes
  5. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 08 May 2008 Link to this post

    Hi Jon,

    Thanks again for the comments!

    I'm not sure if the addition of an empty handler would not be confusing. We haven't taken the decision yet, but there are two most probable solutions:
    • Add an AutoPostBack property (defaulting to false, similar to RadToolBar "Classic");
    • Change RadToolBar to always perform a postback unless PostBack="false" set to a button item.
    Cheers,
    Erjan Gavalji
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Jeff Snyder
    Jeff Snyder avatar
    22 posts
    Member since:
    Dec 2007

    Posted 13 May 2008 Link to this post

    I migrated to the "Prometheus" version of the toolbar control.  Previously, with CommandName="Cancel", the toolbar would automatically close the usercontrol on which the toolbar was placed.  What do I need to do in the code behind for the user control in order to close it when the Cancel toolbar button is clicked?  I have created a RadToolBar2_ButtonClick event, but I assume that I need something equivalent to "parent.close()"?

    Thanks
    Jeff
  7. Jon Stromer-Galley
    Jon Stromer-Galley avatar
    15 posts
    Member since:
    Aug 2007

    Posted 13 May 2008 Link to this post

    I used this:

    protected void RadToolBar1_ButtonClick(object sender, RadToolBarEventArgs e)
    {
        // Telerik Bug? Need an empty handler
        //HandleToolBarClick((RadToolBarButton)e.Item);
    }

    If the only commands being sent are "cancle" or "update" or one of the other standard command then I left the HandleToolBarClick() commented out.  If there are commands that require custom logic I handled that in the HandleToolBarClick() but did not handle the standard commands.

  8. Jeff Snyder
    Jeff Snyder avatar
    22 posts
    Member since:
    Dec 2007

    Posted 13 May 2008 Link to this post

    Thanks Jon.  Yes, I have done the same thing as you with no luck.  I stepped into the event handler just to make sure that it is being fired...
  9. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 13 May 2008 Link to this post

    Hi Jeff Snyder,

    There are a number of ways to "close" a user control. For example, you can set its Visible property to false, or you can remove it from the Controls collection of its parent. Here is a sample code for setting the control to invisible

    protected void RadToolBar1_ButtonClick(object sender, EventArgs e)
    {
        string commandName;
        if (e.Item is RadToolBarButton)
        {
           commandName = ((RadToolBarButton)e.Item).CommandName;
        }
        else
        {
           commandName = ((RadToolBarSplitButton)e.Item).CommandName;
        }
        if (commandName == "cancel")
        {
           myUserControl.Visible = false;
        }
    }

    I hope this helps.

    Kind regards,
    Erjan Gavalji
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  10. Jeff Snyder
    Jeff Snyder avatar
    22 posts
    Member since:
    Dec 2007

    Posted 13 May 2008 Link to this post

    Thanks Erjan.  I ended up doing a Parent.Visible = False in the codebehind for the user control.  Now, this same user control is the edit form for a RadGrid.  Previously, using the toolbar in the non-Prometheus version, the Update command for the toolbar inside the user control would fire the RadGrid_UpdateCommand event.  Obviously, that code is in the codebehind for the parent aspx page.  What do I need to do in the OnButtonClick event of the user control in order to fire the RadGrid_UpdateCommand event in the parent aspx page?
  11. Jeff Snyder
    Jeff Snyder avatar
    22 posts
    Member since:
    Dec 2007

    Posted 13 May 2008 Link to this post

    If the user control is an edit form for a RadGrid, how do I remove the user control from the Controls collection of the parent aspx page and from the parent RadGrid?

    I guess it would help if I actually knew what the non-Prometheus version of the toolbar's Cancel command was doing to the user control within the RadGrid...
  12. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 14 May 2008 Link to this post

    Hi Jeff,

    I'm sorry I didn't understand the original scenario. Actually you don't have to hide the edit form user control by code. This behavior is internal for RadGrid. All you need to do is set the proper CommandName for the RadToolBarButton.

    The RadToolBar1_ButtonClick event handler is needed for the RadToolBar to make a postback. The RadToolBar in the Service Pack release (scheduled for the end of this week) will contain an AutoPostBack property, which will make the need of ButtonClick event handler assignment obsolete.

    Please, find attached a demo page I just created.

    Let me know if that helps.

    Kind regards,
    Erjan Gavalji
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  13. Jeff Snyder
    Jeff Snyder avatar
    22 posts
    Member since:
    Dec 2007

    Posted 14 May 2008 Link to this post

    Thanks Erjan.  After trying to execute your example, it looks like I need to add an HttpHandler in my web.comfig.  It also looks like other "Prometheus" controls will need HttpHandlers as well.  Is there a document that describes all of the entries that need to be added to the web.config for the AJAX version of the controls?
  14. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 14 May 2008 Link to this post

    Hi Jeff,

    In the example I sent you the control that requires an HttpHandler is RadScriptManager. The control needs the Telerik.Web.UI.WebResource.axd handler. The RadScriptManager page in the RadControls for ASP.NET Ajax Online Documentation contains more information about this specific HttpHandler registration.

    Other controls in the suite that need HttpHandlers registered are: RadEditor, RadSpell, RadUpload and RadChart.

    FYI, the Smart Tags of the control designers provide verbs for automatic HttpHandler registration.

    I hope this helps.

    Best regards,
    Erjan Gavalji
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  15. Jeff Snyder
    Jeff Snyder avatar
    22 posts
    Member since:
    Dec 2007

    Posted 14 May 2008 Link to this post

    Thanks Erjan.  I registered the Http Handler.  When I run your page, I get a JavaScript error on the default.aspx page.  It states that Telerik is undefined.  I have the Telerik.Web.UI dll in the bin folder.  The grid displays but the toolbar buttons do nothing when clicked.
  16. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 15 May 2008 Link to this post

    Hi Jeff,

    Are you running the website in IIS7 integrated mode? If so, the HttpHandlers should be manually registered to the <webserver> section of the application configuration file. Unfortunately we still didn't find a way to register the handlers automatically.

    You might want to check the Troubleshooting section, it contains some useful information about some setup related problems.

    FYI, for the demonstration purpose you can avoid this exact problem by replacing the RadScriptManager instance with a ScriptManager one.

    Kind regards,
    Erjan Gavalji
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  17. Jeff Snyder
    Jeff Snyder avatar
    22 posts
    Member since:
    Dec 2007

    Posted 15 May 2008 Link to this post

    Hi Erjan,

    I replaced the RadScriptManager last night, hoping that would resolve the issues.  Obviously, the JavaScript error went away.  However, the toolbar buttons still do nothing in your demo code.  A postback does occur, but the user control remains.  Please advise.

    Thanks
    Jeff
  18. Jeff Snyder
    Jeff Snyder avatar
    22 posts
    Member since:
    Dec 2007

    Posted 15 May 2008 Link to this post

    Also, I resolved the issue with the RadScriptManager this morning by looking at the troubleshooting document.  So, we just need to figure out why the toolbar buttons do nothing.
  19. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 15 May 2008 Link to this post

    Hi Jeff,

    Are you using the official RadControls for ASP.NET AJAX release? The RadToolBar control was not finished in the Futures build.

    Looking forward to your reply,
    Erjan Gavalji
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  20. Jeff Snyder
    Jeff Snyder avatar
    22 posts
    Member since:
    Dec 2007

    Posted 15 May 2008 Link to this post

    Ah, that is it.  Yes, I am still using the Futures build.  Thanks for your help and the quick responses!
  21. Jeff Snyder
    Jeff Snyder avatar
    22 posts
    Member since:
    Dec 2007

    Posted 15 May 2008 Link to this post

    Hi Erjan,

    I just checked my client.net account.  I do not have a link to download the latest version of the AJAX controls.  We just purchased the non-Prometheus suite of products in the pasy 6 months, so we should be eligible for the AJAX controls.  Correct?

    Thanks
    Jeff
  22. Petia
    Admin
    Petia avatar
    25 posts

    Posted 15 May 2008 Link to this post

    Hello Jeff Snyder,

    I have replied to your question in a separate personal email.

    Best wishes,
    Petia
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  23. Petia
    Admin
    Petia avatar
    25 posts

    Posted 15 May 2008 Link to this post

    Hello Jeff Snyder,

    I have replied to your question in a separate personal email.

    Best wishes,
    Petia
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  24. Jeff Snyder
    Jeff Snyder avatar
    22 posts
    Member since:
    Dec 2007

    Posted 15 May 2008 Link to this post

    Hi Petia,

    I have not received the email.

    Thanks
    Jeff
  25. Petia
    Admin
    Petia avatar
    25 posts

    Posted 15 May 2008 Link to this post

    Hello Jeff Snyder,

    I have resent the email, you might receive it twice. Please make sure the telerik.com domain is whitelisted, as I am sending from an European IP address and sometimes emails get blocked.

    Please email petia.mintcheva@telerik.com directly, if you have not received the email within a couple of hours.

    Best wishes,
    Petia
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017