如何从gridview中的日历中选择日期时如何进行回发 [英] How do I make a postback when date is selected from calendar inside gridview

查看:88
本文介绍了如何从gridview中的日历中选择日期时如何进行回发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,



我有一个带有日期列的网格,当用户从gridview中的日历中选择日期时,我想要回发或触发文本框事件编辑模式。



但以下代码不会触发文本框更改事件..

我想触发文本框/日历事件时用户做出选择。



我尝试过:



< pre lang =HTML> < asp:TemplateField HeaderText = 日期 > < itemtemplate >
< asp:TextBox ID < span class =code-keyword> = txtDischargeDate runat = server ReadOnly = true CssClass = txtb 宽度 = 80px OnTextChanged = txtDischarge Date_TextChanged >
< asp:图像 ID = Image2 runat < span class =code-keyword> = server ImageUrl = 〜/ Images / ew_calendar.gif / >
< cc1:calendarextender cssclass = cal_Theme1 id = Cal1 runat = server popupbuttonid = Image2 targetcontrolid = txtDischargeDate >

解决方案

日历扩展程序具有客户端OnClientDateSelectionChanged事件。添加隐藏按钮并处理按钮的单击事件。现在在OnClientDateSelectionChanged函数中,调用按钮单击事件。它会回发到服务器上按钮的点击事件,你可以在那里进行处理。



或者检查日历的服务器端事件(如果他们添加了一些)。如果您有DateSelected,请使用该回发来执行您需要执行的任何操作


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: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">

解决方案

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


这篇关于如何从gridview中的日历中选择日期时如何进行回发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆