Click here to Skip to main content
15,908,675 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear,

I have a grid with date column where i want to make a postback or trigger an textbox event when user selects date from calendar inside a gridview with edit mode.

but the below code does not trigger text box changed event..
I want to trigger a textbox/calendar event when user makes a selection.

What I have tried:

ASP.NET
 <asp:TemplateField HeaderText="Date" >                                                       <itemtemplate>
<asp:TextBox ID="txtDischargeDate" runat="server" ReadOnly="true" CssClass="txtb" Width="80px" OnTextChanged="txtDischargeDate_TextChanged">
<asp:Image ID="Image2" runat="server" ImageUrl="~/Images/ew_calendar.gif"  />
<cc1:calendarextender cssclass="cal_Theme1" id="Cal1" runat="server" popupbuttonid="Image2" targetcontrolid="txtDischargeDate">
Posted
Updated 15-Nov-16 0:29am

1 solution

The calendar extender has a client-side OnClientDateSelectionChanged event. Add a hidden button and handle the click event of the button. Now in the OnClientDateSelectionChanged function, call the button click event. It will postback to the button's click event on the server and you can do your processing there.

Or check server side events (if they added some) of the calendar. If you have DateSelected, use that postback to do whatever you need to do
 
Share this answer
 

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