用户控制页面的问题
我开始放弃对这个问题进行故障排除...我有一个 .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...这是为什么? 我尝试将解决方案转换为网络应用程序,但它不起作用。 尝试添加:
protected global::ClubSite dp1; 受保护的全局::ClubSite tp1;
在 ascx.designer.cs 中
,但全局以红色突出显示,
这是我的完整解决方案的链接:
http://cid-1bd707a1bb687294.skydrive.live.com/self.aspx/.Public/Permias.zip
I am starting to give up troubleshooting this issue I had... I had an .ascx page and had the following user control in it:
<td>
<Club:DatePicker ID="dp1" runat="server" />
</td>
however in my code behind when I tried to write methods:
public System.DateTime startDateTime
{
get
{
return dp1.SelectedDate.Add(tp1.SelectedTime.TimeOfDay);
}
set
{
dp1.SelectedDate = value;
tp1.SelectedTime = value;
}
}
It can't reference dp1(dp1 is underlined in red) as well as tp1... why is this??
I've tried to convert the solution to a web application and yet it doesn't work.
Tried adding:
protected global::ClubSite dp1;
protected global::ClubSite tp1;
in the ascx.designer.cs
but then the global is highlighted in red
here's the link to my full solution:
http://cid-1bd707a1bb687294.skydrive.live.com/self.aspx/.Public/Permias.zip
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的
DurationPicker.ascx.designer.cs
应该如下所示,加上一些注释:我编辑了您的 .ascx 标记,这看起来很好,似乎是 Visual Studio 挂在您这边的东西,不允许这样做发生。您可以执行以下操作来手动触发此操作:
DurationPicker.ascx.designer.cs
DurationPicker.ascx
这应该重新生成
DurationPicker.ascx.designer.cs
文件。Your
DurationPicker.ascx.designer.cs
should look like this, plus some comments:I edited your .ascx markup and this appeared fine, seems to be something visual studio's hanging onto on your side that's not letting this happen. One thing you can do to trigger this manually:
DurationPicker.ascx.designer.cs
DurationPicker.ascx
This should re-generate the
DurationPicker.ascx.designer.cs
file.