i didnt get any error in runtime. but updation event not working.... So Please help me to recover this problem..
Default.aspx.cs
----------------
protected void grdv_RowEditing(object sender, GridViewEditEventArgs e)
{
grdvCustomer.EditIndex = e.NewEditIndex;
bind();
}
protected void Grdv_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
grdvCustomer.EditIndex = -1;
bind();
}
protected void grdv_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
// Response.Write("");
GridViewRow row = (GridViewRow)grdvCustomer.Rows[e.RowIndex];
Label lbl = (Label)row.FindControl("lblComId");
TextBox txtCmt = (TextBox)row.FindControl("txtComments");
DropDownList drpfdb = (DropDownList)row.FindControl("drpFeedback");
DropDownList drpStat = (DropDownList)row.FindControl("drpStatus");
conn.Open();
SqlCommand cmd = new SqlCommand("update compliants set status='" + drpStat.SelectedItem.Text + "',comments='" + txtCmt.Text + "' ,feedback ='" + drpfdb.SelectedItem.Text + "'where comid='" + lbl.Text + "'", conn);
cmd.ExecuteNonQuery();
grdvCustomer.EditIndex = -1;
conn.Close();
bind();
}
public void bind()
{
conn.Open();
SqlDataAdapter da = new SqlDataAdapter("select * from compliants where customerid='" + lblCusAns.Text + "' ", conn);
DataSet ds = new DataSet();
da.Fill(ds, "compliants");
grdvCustomer.DataSource = ds.Tables[0].DefaultView;
grdvCustomer.DataBind();
conn.Close();
}
protected void grdv_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
grdvCustomer.PageIndex = e.NewPageIndex;
bind();
}
Source Code
-------------
BorderColor="#999999"
BorderStyle="Solid"
BorderWidth="1px"
CellPadding="3"
ForeColor="Black"
GridLines="Vertical"
AutoGenerateColumns="False"
OnRowEditing="grdv_RowEditing "
OnRowCancelingEdit="Grdv_RowCancelingEdit"
OnRowUpdating="grdv_RowUpdating"
OnPageIndexChanging="grdv_PageIndexChanging" >
Suthish NairPosted May 23, 2011, 1:53 PM
msdn
Ankit NandekarPosted May 23, 2011, 5:10 AM
send me ur both files i will design and cs i will check it.
SanthonabinPosted May 23, 2011, 5:01 AM
i used break point, but while running controls not move into that update function..... and also not have error in that... Please help to recover this problem
Ankit NandekarPosted May 20, 2011, 12:49 AM
SqlCommand cmd = new SqlCommand("update compliants set status='" + drpStat.SelectedItem.Text + "',comments='" + txtCmt.Text + "' ,feedback ='" + drpfdb.SelectedItem.Text + "'where comid='" + lbl.Text + "'", conn);
if u r getting value in txt.cmt and lbl.Text then check postback.
SanthonabinPosted May 19, 2011, 11:38 PM
Posted May 19, 2011, 5:21 AM
Krishna GaradPosted May 19, 2011, 5:19 AM