0

我开始放弃对我遇到的这个问题进行故障排除......我有一个 .ascx 页面,其中包含以下用户控件:

<td>
                <Club:DatePicker ID="dp1" runat="server" />
</td>

但是当我尝试编写方法时,在我的代码后面:

 public System.DateTime startDateTime
        {
            get
            {
                return dp1.SelectedDate.Add(tp1.SelectedTime.TimeOfDay);
            }
            set
            {
                dp1.SelectedDate = value;
                tp1.SelectedTime = value;
            }
        }

它不能引用 dp1(dp1 带有红色下划线)以及 tp1 ......这是为什么?我试图将解决方案转换为 Web 应用程序,但它不起作用。尝试添加:

受保护的全局::ClubSite dp1;受保护的全球::ClubSite tp1;

在 ascx.designer.cs

但随后全局以红色突出显示

这是我的完整解决方案的链接:

http://cid-1bd707a1bb687294.skydrive.live.com/self.aspx/.Public/Permias.zip

4

1 回答 1

0

DurationPicker.ascx.designer.cs应该看起来像这样,加上一些评论:

namespace Permias {
    public partial class DurationPicker {
        protected global::ClubSite.DatePicker dp1;
        protected global::ClubSite.TimePicker tp1;
        protected global::ClubSite.DatePicker dp2;
        protected global::ClubSite.TimePicker tp2;
    }
}

我编辑了你的 .ascx 标记,这看起来很好,似乎是视觉工作室挂在你身边的东西,不会让这种情况发生。您可以做一件事来手动触发它:

  1. 删除DurationPicker.ascx.designer.cs
  2. 右键单击DurationPicker.ascx
  3. 单击转换为 Web 应用程序

这应该重新生成DurationPicker.ascx.designer.cs文件。

于 2010-03-31T01:37:58.917 回答