Access Control outside of Telerik:Grid scope

4 posts, 0 answers
  1. Jako
    Jako avatar
    107 posts
    Member since:
    Apr 2012

    Posted 30 Apr 2012 Link to this post

    Hi everyone

    I have a page setup like the following:
    Master Page
        ContentPlaceHolder
            RadScriptManager
            RadAjaxManager
            RadGrid
            MasterTableView
                NestedViewTemplate
                    RadTabStrip
                    RadMultiPage
                    RadPageView

    On the page view I have some commands, but I want to show a success/failure message that is allocated directly under the ContentPlaceHolder:
    <asp:Panel ID="uxMessagePanel" Visible="false" runat="server" CssClass="message success">
        <asp:Label ID="uxMessageLabel" runat="server" />
    </asp:Panel>

    When I click on the delete button, all actions work as they need to, but the message never becomes visible? Any reason why it should not be working?
    RadButton uxDeleteContact = (RadButton)sender;
    GridNestedViewItem currentNestedRow = (GridNestedViewItem)uxDeleteContact.NamingContainer;
    GridDataItem currentRow = (GridDataItem)currentNestedRow.ParentItem;       
             
    //some other code here
             
    //Show Success Message to User
    ((Panel)(currentRow.Parent.Parent.Parent.Parent.FindControl("uxMessagePanel"))).Visible = true;
    ((Label)(currentRow.Parent.Parent.Parent.Parent.FindControl("uxMessageLabel"))).Text = "Contact successfully deleted.";

    Im not getting an error, and when I view the currentRow.Parent.Parent.Parent.Parent object when in debug mode, it says ContentPlaceHolder.

    Any ideas?

  2. Antonio Stoilkov
    Admin
    Antonio Stoilkov avatar
    530 posts

    Posted 03 May 2012 Link to this post

    Hi Jako,

    You are describing that the Panel is placed next to ContentPlaceHolder which means you should access the ContentPlaceHolder parent in order to find the control, instead of accessing the ContentPlaceHolder directly. You could try using the currentRow.Parent.Parent.Parent.Parent.Parent object.

    If your issue still persists you could open a formal ticket and attach a sample running project demonstrating the desired functionality in order to further investigate and advise you with the best possible solution.

    Regards,
    Antonio Stoilkov
    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. Jako
    Jako avatar
    107 posts
    Member since:
    Apr 2012

    Posted 10 May 2012 Link to this post

    Hi Antonio

    Sorry, they are not on the same level, the MessagePanel is a "child item" of the place holder, here is a skeleton of my ASPX file
    <asp:Content ID="WorkInProgressContent" ContentPlaceHolderID="ContentHolder" Runat="Server">
        <p class="pageheader strong">Work In Progress</p>
            <asp:Panel ID="uxMessagePanel" Visible="false" runat="server" CssClass="message_good" >
                <asp:Label ID="uxMessageLabel" runat="server" />
            </asp:Panel>
        <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" />
        <telerik:RadAjaxLoadingPanel ID="WorkInProgressLoadingPanel" runat="server" />
        <telerik:RadGrid />
            <MasterTableView >
                <NestedViewTemplate>
                    <asp:Panel>
                        <telerik:RadTabStrip ID="uxTabMenuStrip" runat="server" MultiPageID="uxMultiPageWIPDetail" SelectedIndex="0" Align="Justify" Width="1050px" ontabclick="TabMenuStrip_TabClick" >
                            <Tabs>
                            </Tabs>
                        </telerik:RadTabStrip>
                        <telerik:RadMultiPage>
                            <telerik:RadPageView ID="uxOfficialUsePage" runat="server">
                            </telerik:RadPageView>
                            <telerik:RadPageView ID="uxBusinessPage" runat="server">
                                <asp:FormView ID="uxBusinessDetailView" runat="server">
                                </asp:FormView
                                    <telerik:RadButton //FROM THIS ACTION I WANT TO CHANGE uxMessagePanel and uxMessageLabel  />        
                            </telerik:RadPageView>              
                        </telerik:RadMultiPage>
                    </asp:Panel>
                </NestedViewTemplate>
                <Columns>
                    <telerik:GridBoundColumn HeaderText="Stage Completed" DataField="Status" UniqueName="Status" />               
                    .
                    .
                    .
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    </asp:Content>

    I have also tried this as a test, but its not working, no errors either??
    RadButton uxDeleteContact = (RadButton)sender;
    GridNestedViewItem currentNestedRow = (GridNestedViewItem)uxDeleteContact.NamingContainer;
    GridDataItem currentRow = (GridDataItem)currentNestedRow.ParentItem; 
     
    //Show Success Message to User
    GridTableView gtv = (GridTableView)(currentRow.Parent.NamingContainer);
    RadGrid rg = (RadGrid)gtv.NamingContainer;
    ContentPlaceHolder cph = (ContentPlaceHolder)rg.NamingContainer;
     
    ((Panel)cph.FindControl("uxMessagePanel")).Visible = true;
    ((Label)cph.FindControl("uxMessageLabel")).Text = "Contact successfully deleted.";
  4. Antonio Stoilkov
    Admin
    Antonio Stoilkov avatar
    530 posts

    Posted 15 May 2012 Link to this post

    Hello Jako,

    I have assembled a sample project demonstrating the desired functionality. I have successfully created it with the provided code. You could take a look at it and see if there are any differences at your end which are different.

    Kind regards,
    Antonio Stoilkov
    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.
Back to Top