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 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...