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

change visibility of toolbar buttons failed

1 Answer 42 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 19 Jun 2010, 05:33 PM
Hello,

I have the following Toolbar. Depending on conditions that are evaluated in the databound event of a formview named "fv_ProjectData", I want to enable/disable some buttons. The problem is, that the buttons arenĀ“t updated. The databound event fires as expected and the visible properties of the toolbar buttons are set correctly. But the buttons are updated only when clicking for example another button. What settings in the Ajax Manager are necessary that the formview updates the buttons.
 
Any ideas ?
Robert

       <telerik:RadToolBar ID="rtb_DataButtons" runat="server"  OnClientButtonClicking="ClientButtonClicking" OnButtonClick="rtbDataButtons_ButtonClick" AutoPostBack="True">  
                        <Items> 
                            <telerik:RadToolBarButton runat="server" Value="New" Text="New" ImageUrl="~/img/AddRecord.gif" CommandName="New">  
                            </telerik:RadToolBarButton> 
                            <telerik:RadToolBarButton runat="server" Value="Save" Text="Save" ImageUrl="~/img/Update.gif" CommandName="Save" > 
                            </telerik:RadToolBarButton> 
                            <telerik:RadToolBarButton runat="server" Value="Edit" Text="Edit" ImageUrl="~/img/Edit.gif" CommandName="Edit">  
                            </telerik:RadToolBarButton> 
                            <telerik:RadToolBarButton runat="server" Value="Cancel" Text="Cancel" ImageUrl="~/img/Cancel.gif" CommandName="Cancel" CausesValidation="False">  
                            </telerik:RadToolBarButton> 
                            <telerik:RadToolBarButton runat="server" Value="Delete" Text="Delete" ImageUrl="~/img/Delete.gif" CommandName="Delete" CausesValidation="False">  
                            </telerik:RadToolBarButton> 
                            <telerik:RadToolBarButton runat="server" Value="Separator_1" IsSeparator="true">  
                            </telerik:RadToolBarButton> 
                            <telerik:RadToolBarButton runat="server" Value="Print" Text="Print" ImageUrl="~/img/Print.gif" CommandName="Print">  
                            </telerik:RadToolBarButton> 
                        </Items> 
                    </telerik:RadToolBar> 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest" > 
    <AjaxSettings > 
        <telerik:AjaxSetting AjaxControlID="fv_ProjectData">  
                <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="fv_ProjectData"></telerik:AjaxUpdatedControl> 
                        <telerik:AjaxUpdatedControl ControlID="rtb_DataButtons"></telerik:AjaxUpdatedControl> 
                    </UpdatedControls> 
             </telerik:AjaxSetting>   
    </AjaxSettings> 
</telerik:RadAjaxManager>        
 

    Protected Sub fvProject_Databound(ByVal sender As Object, ByVal e As EventArgs)  
       <.. some code ...> 
 
       SetControls(sender)  
 
    End Sub  
 
  Sub SetControls(ByVal aFormview As FormView)  
        If aFormview Is Nothing Then  
            ToolbarBtn_New.Visible = True 
            ToolbarBtn_Edit.Visible = False 
            ToolbarBtn_Save.Visible = False 
            ToolbarBtn_Cancel.Visible = False 
            ToolbarBtn_Delete.Visible = False 
            ToolbarBtn_Separator1.Visible = False 
            ToolbarBtn_Print.Visible = False 
        Else  
            With aFormview  
        ToolbarBtn_New.Visible = (.CurrentMode = FormViewMode.ReadOnly)  
            ToolbarBtn_Edit.Visible = (.CurrentMode = FormViewMode.ReadOnly)  
        ToolbarBtn_Save.Visible = ((.CurrentMode = FormViewMode.Edit) Or (.CurrentMode = FormViewMode.Insert))  
end with  
end if  
 
 

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 24 Jun 2010, 08:59 AM
Hello Robert,

I'm afraid that I'm unable to recreate the behavior you have described locally. I have attached a small test page, please take a look and let us know if I'm missing something obvious.

Greetings,
Rosen
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
Tags
Ajax
Asked by
Robert
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or