problems with user control page
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
Your DurationPicker.ascx.designer.cs
should look like this, plus some comments:
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;
}
}
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:
- Delete
DurationPicker.ascx.designer.cs
- Right click on
DurationPicker.ascx
- Click Convert to Web Application
This should re-generate the DurationPicker.ascx.designer.cs
file.
精彩评论