Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi to all ,

i am using calender control in my application from visual studio.

my .aspx page is given below.
XML
<td><asp:TextBox ID="FromCalTextBox" runat="server" CssClass="BoxText" ></asp:TextBox>
     <asp:UpdatePanel ID="UpdatePanel3" runat="server">
         <ContentTemplate>
     <asp:Calendar ID="Calendar1" runat="server"
     onselectionchanged="Calendar1_SelectionChanged" ShowGridLines="True"
     Visible="False" CellPadding="1" DayNameFormat="Shortest" Height="71px"
     Width="71px"></asp:Calendar>
     </ContentTemplate>
      <Triggers>
   <asp:AsyncPostBackTrigger ControlID="btnShowCalendar" EventName="click" />
   </Triggers>
     </asp:UpdatePanel>
     <asp:Button ID="btnShowCalendar" runat="server" CssClass="Btn"
     Text="From Date" onclick="btnShowCalendar_Click" /></td>
     <td>

my .aspx.cs file is given below
C#
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
   {
       FromCalTextBox.Text = Calendar1.SelectedDate.ToString("dd/MM/yyyy");
       Calendar1.Visible = false;
   }

C#
protected void btnShowCalendar_Click(object sender, EventArgs e)
   {
       Calendar1.Visible = true;
   }


when i click on button calender show but when i select the date its not display with textbox..

please help me...........
Posted
Updated 14-Dec-10 22:08pm
v2

Please see, the textbox is NOT inside the update panel and thus it does not gets refreshed when the update panel is triggered.

You need to put the textbox inside the update panel.
 
Share this answer
 
Comments
Toniyo Jackson 15-Dec-10 5:53am    
Correct answer
[no name] 15-Dec-10 11:18am    
ToniyoJackson: Your trolling for reputation has been noted. Please refrain from such trivial comments and edits. Only post comments to clarify or update a question or answer.
hi Sandeep,

if i add the textbox within update panel its not work.

my aspx code is given below
XML
<asp:UpdatePanel ID="UpdatePanel3" runat="server">
     <ContentTemplate>
     <td><asp:TextBox ID="FromCalTextBox" runat="server" CssClass="BoxText" ></asp:TextBox>
     <asp:Calendar ID="Calendar1" runat="server"
     onselectionchanged="Calendar1_SelectionChanged" ShowGridLines="True"
     Visible="False" CellPadding="1" DayNameFormat="Shortest" Height="71px"
     Width="71px"></asp:Calendar>
     </ContentTemplate>
     <Triggers>
      <asp:AsyncPostBackTrigger ControlID="btnShowCalendar" EventName="click" />
     </Triggers>
      </asp:UpdatePanel>
     <asp:Button ID="btnShowCalendar" runat="server" CssClass="Btn"
     Text="From Date" onclick="btnShowCalendar_Click" /></td>

when i run page its not popup the calender on button click.

please help me.
 
Share this answer
 
v2
Comments
Sandeep Mewara 15-Dec-10 6:10am    
First of all the 'td' is wrongly placed. Form the HTML properly. (For the time being you can remove it)
Now, after that, debug and see if the execution is going as per desired or not. rest all looks ok and should work.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900