gridview will not update does not give no error

GridView in ASP.NET will not update but it give no error. This took some 1+ hour of mine trying to resolve. I looked at this popular post but I could not find solution to my problem.

The problem in my case was the select statement.

select * from TrackerMileStones where IndID = case when @IndID is null then IndID else @IndID end

The problem line was @IndID parameter, although my Gridview worked perfectly fine. I removed the where clause just for testing purpose and the update started function fine. So the problem is quite weird, select should not affect update operation but in this case it does!

Besides, also look into DataKeyNames parameter of gridview and set it to your primary key, usually ID field.

This entry was posted in Uncategorized and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s