Accessing values of a control which is in a user control

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
 
O

Onwuka Emeka

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top