我的前台代码是这样的:
<asp:TextBox ID="txtBeginTime" runat="server"
             CssClass="Wdate"
             onClick="new WdatePicker(this,'%Y-%M-%D',false,'whyGreen')"
             ReadOnly="false" >
</asp:TextBox>另外问一下,这里的readonly是false呀还是TRUE然后在后台中
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack){this.txtBeginTime.Text = DateTime.Now.ToShortDateString();}
}
然后我写了个方法需要用到选择后的时间,于是我就在方法里面写string start = Request.Params["txtBeginTime"];
结果是Null,难道选择后时间的获取不能放在方法里,要放到事件里写吗?各位大师有谁知道的赶紧给我说一下,急用,谢谢

解决方案 »

  1.   

    为什么不直接用string start=txtBeginTime.Text呢或者<asp:TextBox ID="txtBeginTime" runat="server"
       CssClass="Wdate"
       onClick="new WdatePicker(this,'%Y-%M-%D',false,'whyGreen')"
       ReadOnly="true" >
    </asp:TextBox
      

  2.   

    html中 只要 readonly有值就会使readonly有效<!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="gb2312" />
    <title></title>
    </head>
    <body>
    <input readonly="123" />
    </body>
    </html>写123,false true 都有效
    xhtml 要求是写 readonly="readonly"
    js的话 可以这样写
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="gb2312" />
    <title></title>
    </head>
    <body>
    <input />
    <script>
    function $(el){
    return typeof el == 'string' ? document.getElementById(el) : el;
    }
    function $t(name, cot){
    cot = cot || document;
    return cot.getElementsByTagName(name);
    }

    //$t('input')[0].readOnly = false;
    $t('input')[0].readOnly = true;

    </script>
    </body>
    </html>