Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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?

[EDIT - OPs code from a "solution"]
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();
                      }
        }
    }
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...
Posted
Updated 24-Mar-14 3:43am
v3
Comments
Nelek 28-Feb-14 5:28am    
Please use the "improve question" and add a piece of code envolved. There are thousands of ways to screw things up, how are we supposed to know which one did you found?
Post your code.
Member 10476757 28-Feb-14 6:52am    
Show your code
Manikandan K 19-Mar-14 2:56am    
Post your code
CHill60 24-Mar-14 8:32am    
Because you posted a solution your question dropped out of the list of unanswered questions. I've moved your code and comment into your original question (using the Improve Question link) and removed your solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900