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

Access Control outside of Telerik:Grid scope

3 Answers 43 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jako
Top achievements
Rank 1
Jako asked on 30 Apr 2012, 02:13 PM
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?

3 Answers, 1 is accepted

Sort by
0
Antonio Stoilkov
Telerik team
answered on 03 May 2012, 08:16 AM
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.
0
Jako
Top achievements
Rank 1
answered on 10 May 2012, 10:37 AM
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.";
0
Antonio Stoilkov
Telerik team
answered on 15 May 2012, 06:39 AM
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.
Tags
General Discussions
Asked by
Jako
Top achievements
Rank 1
Answers by
Antonio Stoilkov
Telerik team
Jako
Top achievements
Rank 1
Share this question
or