修改formview的值

 form code:

            <asp:FormView ID="FormViewClient" runat="server" DataKeyNames="client_id" DataSourceID="ClientsObjectDataSource" OnItemUpdating="client_updating">

 

 

  protected void client_updating(object sender, FormViewUpdateEventArgs e)

    {

 

        //FormViewClient.FindControl("");

 

       TextBox tb = (TextBox) FormViewClient.FindControl("date_registeredTextBox");

 

       string text = tb.Text;

       System.Globalization.DateTimeFormatInfo dateInfo = new System.Globalization.DateTimeFormatInfo();

       dateInfo.ShortDatePattern = "dd/MM/yyyy";

        DateTime dt = Convert.ToDateTime( text,dateInfo);

        string test = dt.Date.ToString();

       e.NewValues["date_registered"] = dt.Date.ToString();

       TextBox tb_start = (TextBox)FormViewClient.FindControl("licenced_startTextBox");

 

       string text_start = tb_start.Text;

       DateTime dt_start = Convert.ToDateTime(text_start, dateInfo);

       e.NewValues["licenced_start"] = dt_start.Date.ToString();

       TextBox tb_expired = (TextBox)FormViewClient.FindControl("licenced_expiredTextBox");

 

       string text_expired = tb_expired.Text;

       DateTime dt_expired = Convert.ToDateTime(text_expired, dateInfo);

       e.NewValues["licenced_expired"] = dt_expired.Date.ToString();

     //      // dateInfo.ShortDatePattern = "yyyy/MM/dd";

     //       DateTime dt2 = Convert.ToDateTime(tb.Text,dateInfo);

           double test = dt2.ToOADate();

     //      String test2 = dt2.Date.ToString();

 

       //     string convert = dt2.ToString();

            //tb.Text = dt2.ToString();

      //    string test  = "5/31/2011 12:00:00 AM";

         //  FormViewClient.DataBind();

         //  tb.Text = "";

       //string query = "Update Clients set date_registered=convert(datetime,'"+text+"',103)";

       //CreateConn objcon = new CreateConn();

       // objcon.SQLConnDataTable(query);

    }

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值