Accessing values of a control which is in a user control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

<tr>
<td nowrap=nowrap >Start Date/Time</td>
<td =nowrap><zw:Calendar ID="calStart" runat=server DisplayTime=true
Mandatory=true ReadOnly=true />
</td>
<td nowrap=nowrap>Appointment Type</td>
<td><asp:DropDownList ID="ddlApptType" runat=server>
<asp:ListItem>Meeting</asp:ListItem>
<asp:ListItem>Conference</asp:ListItem>
<asp:ListItem>Personal</asp:ListItem>
<asp:ListItem>General</asp:ListItem>


</asp:DropDownList><asp:Label ID="Label1" runat=server Text="*"
ForeColor=red ></asp:Label>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" Display="None"
runat="server" ControlToValidate="ddlApptType"
ErrorMessage="Please Select Appointment
Type"></asp:RequiredFieldValidator>

</td>

</tr>
<tr>
<td colspan=4 align=center><asp:button id="btnSave" runat="server"
text="Save" OnClick="btnSave_Click" /></td>
</tr>

In the calendar User control I have a property

private string dateTimeValue;
public string DateTimeValue
{
get
{
return txtCalendar.Text;
}
set
{
txtCalendar.Text = value;
}

}


Onclick of the Save button when I try to write like below

Response.Write(calStart.DateTimeValue);

Its showing as null. Could you please help me with what the problem may be.

Thanks in advance
 
Your code looks okay, you might want to make the code for the usercontrol
available as well your problem may be coming from there
 
Back
Top