页脚行文本框默认采用逗号

页脚行文本框默认采用逗号

本文介绍了页脚行文本框默认采用逗号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带脚页行的可编辑网格视图。我用javascript使这个gridview标题静态....

我的问题是当我尝试通过页脚行将数据插入数据库时​​,额外的逗号带有值...

例如 - 我进入状态但它显示,状态....如果我将一个字段留空,它只包含,

可能出现什么问题?





I have an editable gridview with footer row..I made this gridview header static with javascript....
My problem is that when I try to insert data into database through footer row, an extra comma is coming with the value...
E.g - I entered "state" but it is showing ",state"....and if I leave a field empty it simply contains ","
What can be the problem possibly?


protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        //string crcloc = Session["loc"].ToString();
        string val = ViewState["count"].ToString();
        OracleConnection conn = new OracleConnection(cnct);
        conn.Open();
        if (e.CommandName.Equals("newadd"))
        {
            TextBox txtcrc = (TextBox)gridmpt.FooterRow.FindControl("txtcrc_rev");
            TextBox txtmptnm = (TextBox)gridmpt.FooterRow.FindControl("txtmptnm_rev");


            if (txtcrc.Text == "" || txtmptnm.Text=="")
            {
                lblalert.Text = "Please enter necessary data";
            }
            else
            {
                string sqlin = "insert into table";
                OracleCommand cmd = new OracleCommand(sqlin, conn);
                cmd.ExecuteNonQuery();
                OracleCommand cmd1 = new OracleCommand("commit", conn);
                cmd1.ExecuteNonQuery();
                conn.Close();
                grid_mpt();
                      }
        }
    }

默认情况下,这些文本框txtcrc和txtmptnm正在使用逗号。就像当我键入ABC时,ABC ......如何停止这个??整个gridview是一个javascript冻结标题...页脚没有冻结,到达页脚一个必须滚动到底部....



另外我看到解冻gridview使得操作没有错误...但我需要冻结......

these textboxes txtcrc and txtmptnm are taking comma by default..like when I type ABC it takes ,ABC....how to stop this?? The entire gridview is within a javascript that freezes the header...footer is not freezed and to reach footer one has to scroll to bottom....

Also I see that unfreezing the gridview makes the operation error free...but I need the freezing...

推荐答案

这篇关于页脚行文本框默认采用逗号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 03:01