Geeks With Blogs
Sean Rhone
Today I was assigned a a page to finish up for a internal ASP.NET 3.5 application and was working on editing records in the gridview. There are two LinkButtons named for edit and remove and when the user clicks edit button the record is suppose to populate in a form above the grid. Sounds easy enough except when I clicked the link and handled the event so I could populate the form the grid when into editmode as well.

Ok, I've never done in-grid editing but know enough to look at the autocreate* settings to turn this off and was very surprised to see they were not enabled. So, it's time to dig around and the answer is explained in the link below but the short answer is the command name attribute auto enables functionality if you use "Edit", "Delete", or "Select".

Now I'm all for making things easier but auto enabling functionality by a text value is silly. It took me a while to find this and bet I'm not the only person who hit this wall.

So, next time your gridview it auto editing,selecting, or deleting and you don't know why check out the ButtonField or Templete field for command values.

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx Posted on Wednesday, August 12, 2009 7:15 PM | Back to top


Comments on this post:

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Ramblings | Powered by: GeeksWithBlogs.net | Join free