ID not recognized in .ascx page
Posted
by Alexander
on Stack Overflow
See other posts from Stack Overflow
or by Alexander
Published on 2010-03-28T01:01:49Z
Indexed on
2010/03/28
1:03 UTC
Read the original article
Hit count: 311
I have the following code:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DurationPicker.ascx.cs" Inherits="Permias.DurationPicker" %>
<%@ Register TagPrefix="Club" Namespace="ClubSite" %>
<div class="controlblock">
<table>
<tr>
<td>
Start Date:
</td>
<td>
<Club:DatePicker ID="dp1" runat="server" />
</td>
<td>
<Club:TimePicker ID="tp1" runat="server" />
</td>
</tr>
<tr>
<td>
End Date:
</td>
<td>
<Club:DatePicker ID="dp2" runat="server" />
</td>
<td>
<Club:TimePicker ID="tp2" runat="server" />
</td>
</tr>
</table>
</div>
In my code behind I have
public System.DateTime startDateTime
{
get
{
return dp1.SelectedDate.Add(tp1.SelectedTime.TimeOfDay);
}
set
{
dp1.SelectedDate = value;
tp1.SelectedTime = value;
}
}
However dp1 is underlined in red, which means it can't find dp1.. why is this?
© Stack Overflow or respective owner