Access control on different RadPageView

5 posts, 1 answers
  1. Ruth
    Ruth avatar
    3 posts
    Member since:
    Nov 2011

    Posted 08 Nov 2011 Link to this post

    Hi,

    I have a RadTabStrip and RadMultiPage set up with 4 RadPageViews.

    Here is what I want to do:

    When a user is on PageView1 and checks a checkbox I want to disable 2 PageViews(tabs) and disable a combobox and button on PageView4.

    I'm trying to do this all client-side. I figured out how to disable the 2 PageViews but I am having a hard time getting the combobox and button to disable.

    I appreciate your help. Thank you,
    Ruth
  2. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 11 Nov 2011 Link to this post

    Hello Ruth,

    You can directly find the RadComboBox control and disable it using the set_enabled(false) property (for the test I used a simple button that disables the combobox control when clicked). Here is an example how it could be achieved:
    <script type="text/javascript">
            function OnClientClicking() {
                var combo = $find("combo1");
                combo.set_enabled(false);
            }
        </script>

    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1" SelectedIndex="1" Skin="Outlook" >
                <Tabs>
                    <telerik:RadTab Text="Owner" >
                    </telerik:RadTab>
                    <telerik:RadTab Text="Vehicle">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Sales">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Product" >
                    </telerik:RadTab>
                </Tabs>
            </telerik:RadTabStrip>
            <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0">
                <telerik:RadPageView ID="RadPageView1" runat="server" >
                    Page1
                    <br />
                    <telerik:RadButton ID="button11" runat="server" Text="button11" OnClientClicking="OnClientClicking">
                    </telerik:RadButton>
                </telerik:RadPageView>
                <telerik:RadPageView ID="RadPageView2" runat="server">
                </telerik:RadPageView>
                <telerik:RadPageView ID="RadPageView3" runat="server">
                </telerik:RadPageView>
                <telerik:RadPageView ID="RadPageView4" runat="server">
                    <br />
                    <br />
                    Page4
                    <telerik:RadButton Text="buuton1" runat="server" ID="button1">
                    </telerik:RadButton>
                    <br />
                    <telerik:RadComboBox runat="server" ID="combo1">
                        <Items>
                            <telerik:RadComboBoxItem Text="1" />
                            <telerik:RadComboBoxItem Text="2" />
                        </Items>
                    </telerik:RadComboBox>
                </telerik:RadPageView>
            </telerik:RadMultiPage>


    All the best,
    Kate
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ruth
    Ruth avatar
    3 posts
    Member since:
    Nov 2011

    Posted 11 Nov 2011 Link to this post

    Kate,

    Thank you for your response. It worked wonderfully. I didn't specify all my stipulations however. I've updated your code snippet to include the additional situation: (in this case $find(combo1) returns null. Thank you in advance for your help again.)

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
    <%@ Register src="WebUserControl1.ascx" tagname="WebUserControl1" tagprefix="uc1" %>
    <%@ Register src="WebUserControl4.ascx" tagname="WebUserControl4" tagprefix="uc4" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      
    <head runat="server">
        <title></title>
        <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
    </head>
    <body>
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <%--Needed for JavaScript IntelliSense in VS2010--%>
                <%--For VS2008 replace RadScriptManager with ScriptManager--%>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager
          
        <telerik:RadAjaxLoadingPanel runat="server" ID="LoadingPanel1">
         </telerik:RadAjaxLoadingPanel>
            <telerik:RadAjaxManager runat="server" ID="RadAjaxManager2">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadTabStrip1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" />
                            <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" LoadingPanelID="LoadingPanel1" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="RadMultiPage1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" LoadingPanelID="LoadingPanel1" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>
      
        <div>
        <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1" SelectedIndex="1" Skin="Outlook" >
                <Tabs>
                    <telerik:RadTab Text="Owner" >
                    </telerik:RadTab>
                    <telerik:RadTab Text="Vehicle">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Sales">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Product" >
                    </telerik:RadTab>
                </Tabs>
            </telerik:RadTabStrip>
            <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0">
                <telerik:RadPageView ID="RadPageView1" runat="server" >
                    <uc1:WebUserControl1 ID="WebUserControl1" runat="server" />                
                </telerik:RadPageView>
                <telerik:RadPageView ID="RadPageView2" runat="server">
                </telerik:RadPageView>
                <telerik:RadPageView ID="RadPageView3" runat="server">
                </telerik:RadPageView>
                <telerik:RadPageView ID="RadPageView4" runat="server">
                    <uc4:WebUserControl4 ID="WebUserControl4" runat="server" />                
                </telerik:RadPageView>
            </telerik:RadMultiPage>
        </div>
        </form>
    </body>
    </html>
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs" Inherits="RadControlsWebApp1.WebUserControl1" %>
      
    <br />
        <telerik:RadButton ID="button11" runat="server" Text="button11" OnClientClicking="OnClientClicking">
        </telerik:RadButton>
                      
        <script type="text/javascript">
      
        function OnClientClicking() {
                              
            var tabStrip = $find("RadTabStrip1");
            var tabs = tabStrip.get_tabs();
      
            var t1 = tabs.getTab(1);
            var t2 = tabs.getTab(2);
      
            t1.set_enabled(false);
            t2.set_enabled(false);
      
            var combo = $find("combo1");
            combo.set_enabled(false);
            
        }
        </script>
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl4.ascx.cs" Inherits="RadControlsWebApp1.WebUserControl4" %>
    <br />
                    <br />
                    Page4
                    <telerik:RadButton Text="buuton1" runat="server" ID="button1">
                    </telerik:RadButton>
                    <br />
                    <telerik:RadComboBox runat="server" ID="combo1">
                        <Items>
                            <telerik:RadComboBoxItem Text="1" />
                            <telerik:RadComboBoxItem Text="2" />
                        </Items>
                    </telerik:RadComboBox>
  5. Answer
    Kate
    Admin
    Kate avatar
    1898 posts

    Posted 16 Nov 2011 Link to this post

    Hi Ruth,

    To be able to find the RadComobox that is placed in a a user control you will need to use the correct name. In you particular case this would be var combouc = $find("WebUserControl4_combo1");  [TheIDOfTheUserControl_TheIDOfTheControl]. Below is the modified event handler that disables the RadComboBox when a button is clicked:
    function OnClientClicking() {
                var combouc = $find("WebUserControl4_combo1");
                alert(combouc);
                combouc.set_enabled(false);
            }

    All the best,
    Kate
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  6. Ruth
    Ruth avatar
    3 posts
    Member since:
    Nov 2011

    Posted 16 Nov 2011 Link to this post

    Thank you so much!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017