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

The name "owner" does not exist in the current context error

1 Answer 92 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Maciej Siwek
Top achievements
Rank 1
Maciej Siwek asked on 09 Aug 2010, 10:16 AM
Hello again,

I use advanced form and trying to place my own user control in it. Unfortunatelly I'm getting an error 
"The name "owner" does not exist in the current context error"
both in case im using:
'<%# Container.Appointment.Owner.Localization.AdvancedClose %>'
or
- '<%# Owner.Localization.AdvancedClose%>'

I also tried '=' instead of '#' but it didn't work. As well I already have converted .ascx to web application.

Here's my sample:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs" Inherits="Trash.WebUserControl1" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<div class="rsAdvancedEdit" style="position: relative">
    <%-- Title bar.--%>
    <div class="rsAdvTitle">
        <%-- The rsAdvInnerTitle element is used as a drag handle when the form is modal. --%>
        <h1 class="rsAdvInnerTitle">
            Edit Appointment</h1>
        <asp:LinkButton runat="server" ID="AdvancedEditCloseButton" CssClass="rsAdvEditClose"
            CommandName="Cancel" CausesValidation="false" ToolTip='<%# Container.Appointment.Owner.Localization.AdvancedClose %>'>
            <%# Owner.Localization.AdvancedClose%>
        </asp:LinkButton>
    </div>
    <div class="rsAdvContentWrapper">
        <asp:Button ID="btn1" runat="server" Text="Btn" />          
        <asp:Panel runat="server" ID="ButtonsPanel" CssClass="rsAdvancedSubmitArea">
            <div class="rsAdvButtonWrapper">
                <asp:LinkButton CommandName="Update" runat="server" ID="UpdateButton" CssClass="rsAdvEditSave">
                    <span><%# Container.Appointment.Owner.Localization.Save%></span>
                </asp:LinkButton>
                <asp:LinkButton runat="server" ID="CancelButton" CssClass="rsAdvEditCancel" CommandName="Cancel"
                    CausesValidation="false">
                    <span><%# Container.Appointment.Owner.Localization.Cancel%></span>
                </asp:LinkButton>
            </div>
        </asp:Panel>
    </div>
</div>

Lookin forward quick reply.

Best regards,
Maciej

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 09 Aug 2010, 04:16 PM
Hello Maciej,

To be able to use Owner in such a way, you need to expose it as a protected property in code-behind of your user control.
protected RadScheduler Owner
  {
      get
      {
          return Appointment.Owner;
      }
  }

You can download a sample project from here and review the code of the AdvancedForm user control.


Greetings,
Peter
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
Scheduler
Asked by
Maciej Siwek
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or