各位高手....請看看我以下的代碼....為何不能觸動ontextchanged="Txt_Calendar_TextChanged" <asp:TextBox ID="Txt_Calendar" runat="server" Width="110px" CssClass="input1" 
                AutoPostBack="True" ontextchanged="Txt_Calendar_TextChanged" ></asp:TextBox>  
            &nbsp;<img id="Image_blqx1" style="CURSOR: hand; width: 23px; height: 15px;" 
                onclick="popUpCalendar(this,document.forms[0].Txt_Calendar,'yyyy-mm-dd')" 
                src="../Calendar/Images/calendar.gif" alt="time" />以下是我後台的代碼 protected void Txt_Calendar_TextChanged(object sender, EventArgs e)
    {
        PruDs1 = bc.GetDataSet("select * from Ann_POS_PurchaseIDView where PurOrdate='" + this.Txt_Calendar.Text.Trim() + "'", "Ann_POS_PurchaseIDView", 1);
        ProDS1 = bc.GetDataSet("select * from Ann_ERP_SaleProductsView where erp_saleProductsDate='" + this.Txt_Calendar.Text.Trim() + "'", "Ann_POS_PurchaseIDView", 1);
        if (PruDs1.Tables[0].Rows.Count > 0)
        {
            this.GV_PurOrdTitle.DataSource = PruDs1;
            this.GV_PurOrdTitle.DataBind();
        }
        else
        {
            GVNodata(1);
        }
        if (ProDS1.Tables[0].Rows.Count > 0)
        {
            this.GV_SaleOrderTitle.DataSource = ProDS1;
            this.GV_SaleOrderTitle.DataBind();
        }
        else
        {
            GVNodata(2);
        }
    }

解决方案 »

  1.   

    输入内容改变之后,并且光标离开的时候才触发的另外,是否触发,你可以先简单测试
    protected void Txt_Calendar_TextChanged(object sender, EventArgs e)
    {
    Response.Write("显示这里吗");
    }
      

  2.   

    你是用javascript来更改textbox的值的话是不会触发textchanged事件的,可以在js脚本里加一句:
    textBox.fireEvent( "onchange ")或者textBox.onchange()或者form1.submit()来刷新
      

  3.   

    你是用javascript来更改textbox的值的话是不会触发textchanged事件的,可以在js脚本里加一句:
    textBox.fireEvent( "onchange ")或者textBox.onchange()或者form1.submit()来刷新
      

  4.   

    AutoPostBack="True" ,为何要刷新页面呢?
    删除或改成false再试试。