USE e.Row.RowState == DataControlRowState.Edit as shown below, your problem may solve
protected void gdUrlDetails_RowUpdating1(object sender, GridViewUpdateEventArgs e)
{
if (e.Row.RowState == DataControlRowState.Edit )
{
int id = Convert.ToInt32(gdUrlDetails.DataKeys[e.RowIndex].Value.ToString());
TextBox txtUrl = (TextBox)gdUrlDetails.Rows[e.RowIndex].FindControl("txtUrl");
TextBox txtTitle = (TextBox)gdUrlDetails.Rows[e.RowIndex].FindControl("txtTitle");
objurl.UpdatedDate = Convert.ToDateTime(DateTime.Today);
objurl.UpdatedBy = Session["session_staffuserid"].ToString();
objurl.UrlStatus = 1;
objurl.PageId = Convert.ToInt32(ddlPageName.SelectedValue);
URLDetails_Data.UpdateForUrlDetails(Convert.ToInt32(id), txtUrl.Text, txtTitle.Text, objurl.UpdatedBy, DateTime.Today, objurl.UrlStatus, objurl.PageId);
gdUrlDetails.EditIndex = -1;
}
}
Update: the problem looks like that you have also bind your Edit Item template columns with the data from data table, and when you are getting the data in the code behind you are not getting the updated data which the user updates in edit mode and u still getting the old data. If you remove the Binding from the Edit Item Template fields then your code will work.