I developed a gridview in an asp.net page.
the same gridview is binding with data from DB
while running in LocalHost,its refreshing correctly,but when uploading to server,after that its not refreshing.
Ex:
Gridview consists of a delete and edit button,when delete button is pressed,the entire row will delete and grid will refresh.its working fine in localhost,but not in server...
Could you help me?
Code following
public void gridfill()
{
try
{
reader = obj.SelCommand("select ta.id as Code,ta.activity as Activity,tc.client_name as Client,td.department as Department,billable as Billable from tbl_activity ta,tbl_dept td,tbl_client tc where ta.department=td.id and ta.client=tc.id order by cast(ta.id as int)");
using (reader)
{
DataTable dt = new DataTable();
dt.Load(reader);
grdActivity.DataSource = dt;
grdActivity.DataBind();
if (grdActivity.Rows.Count >= 1)
{
grdActivity.HeaderRow.Cells[2].Visible = false;
foreach (GridViewRow gvr in grdActivity.Rows)
{
gvr.Cells[2].Visible = false;
}
}
}
reader.Close();
}
catch (Exception ex)
{
Response.Write("Error in Page:" + ex.Message);
}
}
protected void grdActivity_RowCommand(object sender, GridViewCommandEventArgs e)
{
try
{
if (e.CommandName == "DELETE")
{
int index = Convert.ToInt32(e.CommandArgument);
string activity_id = grdActivity.Rows[index].Cells[2].Text;
obj.IDUCommand("Delete tbl_activity where id='" + activity_id + "'");
gridfill();
lblMessage.Text = "Successfully Deleted";
}
catch (Exception ex)
{
Response.Write("Error in Page:" + ex.Message);
}
}
OP Solved himself - his reply from comment
Thank you all for participating.. i had used image for delete button,so that it seems working sometimes and not getting updated,now i changed it to LINK,so now its working perfectly .....thanks