<asp:TextBox ID="txtPlanFinish" runat="server" Style="position: static" CssClass="input"
Enabled="False">请点击右侧图标选择</asp:TextBox>
<img alt="日历对话框" height="17" onclick="GetDate(txtPlanFinish);return false"
src="../Date/calendar.gif" style="position: static" width="17" />图标点击后弹出一格自定义的日历对话框。 选择后会改变文本框的值, 但是在提交事件中 提交的文本框的值却是“请点击右侧图标进行选择”
为什么?

解决方案 »

  1.   


    <asp:TextBox ID="txtPlanFinish" runat="server" Style="position: static" CssClass="input"
    Enabled="False" Text="请点击右侧图标选择"></asp:TextBox>
    <img alt="日历对话框" height="17" onclick="GetDate(txtPlanFinish);return false"
    src="../Date/calendar.gif" style="position: static" width="17" />
      

  2.   

    这点代码看不出什么问题。贴多点代码来看吧。最好页面就一个这样的TextBox控件,再看看到底是不是这个产生的问题。如果是的话,代码发上来, 大家帮你解决。 你这么点东西,好难看的出问题出在哪儿、
      

  3.   

    你的onclick事件调用了一个JS函数,问题应该出在JS函数中,你可以把JS代码贴出来再看一下
      

  4.   

    protected void btnPut_Click(object sender, EventArgs e)
        {
            try
            {
                string ActivityName = this.txtActivityName.Text;            int TypeId = Convert.ToInt32(ddlType.SelectedValue);            string Effect = txtEffect.Text;            int LinkmanId = Convert.ToInt32(ddlLinkman.SelectedValue);            int CustomerId = Convert.ToInt32(ddlCustomer.SelectedValue);            int ChanceId = Convert.ToInt32(ddlChance.SelectedValue);            int ServiceId = Convert.ToInt32(ddlService.SelectedValue);           /* string PlanStart = "";
                if (txtPlanStart.Text != "请点击右侧图标选择")
                {
                    PlanStart = this.txtPlanStart.Text;
                }*/            string PlanStart = txtPlanStart.Text;
                if (txtPlanStart.Text == "请点击右侧图标选择")
                {
                    PlanStart = "";
                }            string PlanFinish = "";
                if (txtPlanFinish.Text != "请点击右侧图标选择")
                {
                    PlanFinish = txtPlanFinish.Text;
                }            string FactStart = "";
                if (txtFactStart.Text != "请点击右侧图标选择")
                {
                    FactStart = txtFactStart.Text;
                }            string FactFinish = "";
                if (txtFactFinish.Text != "请点击右侧图标选择")
                {
                    FactFinish = txtFactFinish.Text;
                }            string Bulletin = txtIntroduce.Text;            int StateId = Convert.ToInt32(ddlState.SelectedValue);            int PRIId = Convert.ToInt32(ddlPRI.SelectedValue);            string LoginName = Session["LoginName"].ToString();            DateTime OperateTime = DateTime.Now;            sql = "update Tab_Manage_Activity set ActivityName='" + ActivityName + "',TypeId='" + TypeId + "',Effect='" + Effect + "'," +
                    "LinkmanId='" + LinkmanId + "',CustomerId='" + CustomerId + "',ChanceId='" + ChanceId + "'," +
                    "ServiceId='" + ServiceId + "',PlanStartTime='" + PlanStart + "',PlanFinishTime='" + PlanFinish + "'," +
                    "FactStartTime='" + FactStart + "',FactFinishTime='" + FactFinish + "',StateId='" + StateId + "'," +
                    "PRIId='" + PRIId + "',Bulletin='" + Bulletin + "',LoginName='" + LoginName + "'," +
                    "OperateTime='" + OperateTime + "' where ActivityId='"+id+"'";            int n = dfun.ExecSQLDataResult(sql);            if (n > 0)
                {
                    Page.ClientScript.RegisterStartupScript(typeof(string), "1", "<script>alert('修改成功!')</script>");
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(typeof(string), "1", "<script>alert('修改失败!')</script>");
                }
            }
            catch (Exception ex)
            {
                Page.ClientScript.RegisterStartupScript(typeof(string), "1", "<script>alert('"+ex.Message+"')</script>");
            }
        }