单个ajax日历扩展器,用于多个文本框和图像控件?

时间:2010-09-12 01:30:52

标签: javascript asp.net jquery asp.net-ajax

我看多个文本框和(日历)图像控件的单个ajax日历扩展器?

我们怎么能这样做?我在下面找到了关于文本框(不是日历图像)控件的好文章。

请帮助我通过图像控件来解决这个问题

link text

2 个答案:

答案 0 :(得分:0)

Obout有一个非常棒的库,包含AJAX Calendar控件。

答案 1 :(得分:0)

<script type="text/javascript" language="javascript">
            function onlybackbutton(id) {                  

                  if (id == 1) {
                        document.getElementById('<%=txtCdatefrom.ClientID%>').value = "";
                        document.getElementById('<%=imgdatefrom.ClientID%>').click();
                  }
                  else if (id == 2) {
                        document.getElementById('<%=txtCdateTo.ClientID%>').value = "";
                        document.getElementById('<%=imgdateto.ClientID%>').click();
                  }
                  return false;
            }

      </script>



<table>
<tr>
                                          <td>
                                                Created Date From
                                          </td>
                                          <td>
                                                <asp:TextBox ID="txtCdatefrom" runat="server" Width="180px" onpaste="return false;" onmousedown="return onlybackbutton(1);" onkeypress="return onlybackbutton(1);"></asp:TextBox>
                                                <asp:ImageButton ID="imgdatefrom" runat="server" ImageUrl="~/images/DatePicker.gif"
                                                      ImageAlign="Baseline" Height="16px" />
                                                <asp:CalendarExtender ID="calsearchdtfrm" runat="server" Enabled="True" TargetControlID="txtCdatefrom"
                                                      Format="yyyy/MM/dd" PopupButtonID="imgdatefrom">
                                                </asp:CalendarExtender>
                                          </td>
                                          <td>
                                                Created Date To
                                          </td>
                                          <td>
                                                <asp:TextBox ID="txtCdateTo" runat="server" Width="180px" onpaste="return false;" onmousedown="return onlybackbutton(2);" onkeypress="return onlybackbutton(2);"></asp:TextBox>
                                                <asp:ImageButton ID="imgdateto" runat="server" Height="16px" ImageUrl="~/images/DatePicker.gif" />
                                                <asp:CalendarExtender ID="txtsearchdtto_CalendarExtender" runat="server" Enabled="True"
                                                      TargetControlID="txtCdateTo" Format="yyyy/MM/dd" PopupButtonID="imgdateto">
                                                </asp:CalendarExtender>
                                          </td>
                                    </tr></table>