AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
Questions & Answers
Tips & Tricks
 Gridview remains still in edit mode after updating
Posted by archana on  12/11/2009 11:27:57 PM Category: Asp.Net 2.0
Add to my favorites
Email to friend
Hi all, thanks for the reply i actually tried by setting the editindex=-1 and then binding the data but its still in the edit mode...this is my code can any one help me out in this..i am actually using template field columns

string pid = GridView1.Rows[e.RowIndex].Cells[2].Text;
int personId=Int32.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString());

int intResult=0;
GridViewRow row;
row=GridView1.Rows[e.RowIndex];

TextBox tFN = (TextBox)row.FindControl("txtFName");
TextBox tLN = (TextBox)row.FindControl("txtLName");
TextBox tAge = (TextBox)row.FindControl("txtAge");
try
{
intResult=objbal.Update(tFN.Text,tLN.Text,Int32.Parse(tAge.Text),personId);
if(intResult>0)
{
lblMessage.Text="Records updated successfully";
}
else
{
lblMessage.Text="Records could not updated";
}

}
catch(Exception ex)
{
lblMessage.Text=ex.Message.ToString();
}
finally
{
objbal=null;
}

GridView1.EditIndex = -1;
BindData();

Post Your Reply Post New Question

 Viewer's Reply
RE: Gridview remains still in edit mode after updating
Answered By Moderator1 on 12/16/2009 8:03:27 PM
Hi,

I don't find any problem with your code. Make sure your have placed Label controls to bind the field in ItemTemplate section.

Still if you have any problem, please make reply to this post, so others also can understand your problem easily and help you.
 
Post Your Reply If you still have problem, post it again under this reply for better response.

 
Sponsored by
Programmers Heaven C# School Book - Free 338 Page eBook
The PHP Anthology: 101 Essential Tips, Tricks & Hacks, 2nd Edition - Free 207 Page Preview!
FierceDeveloper