By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,212 Members | 1,391 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,212 IT Pros & Developers. It's quick & easy.

How to do 'real' inline editing in GridView

P: n/a
I have a GridView which I'm populating from an ObjectDataSource (give the
GridView a DataTable). The GridView will have about 20 rows, and only one
editable column. The editable column consists of a RadioButtonList ("Yes",
"No", "Not Answered") in a TemplateColumn. I want the user to be able to
select a radio button for each row in the GridView (without having to first
put each row into edit mode). Once the user has selected the Radio button
for each row, they'll post back the form and I want the values from the
radio buttons persisted back to my source DataTable.

The GridView doesn't seem to fire it's RowUpdate/Edit events unless I
actually put one of the rows into edit mode. If I cause a post-back, the
radio button selections are persisted (I guess in the View State) but those
selections don't get pushed through to my ObjectDataSource (it's assigned
update method is not called). It seems the Grid View is not set up to
automatically do 'true' inline editing where you can edit multiple rows in a
single postback. Is there an event of the GridView I can/should use to
persist the selections to my ObjectDataSource's DataTable?
Dec 29 '06 #1
Share this Question
Share on Google+
3 Replies

P: n/a
Hi cpnet,

Happy New Year!

Based on my understanding, your requirement can be achieved using a
customized GridView that supports Bulk Editing:

#Matt Dotson's .NET Tips & Tricks : Real World GridView: Bulk Editing

Using this enhanced GridView control, the rows will all be set to editing
mode, when the Save() method gets called, they will all be saved to the
backend data source. This might be a little different to your original
requirement as you want to postback on every change of the RadioButtonList.
From the performance point of view, I would recommend you to use this batch
updating approach, user will be able to make the changes to all the rows
they're interested, and when a Save button is clicked, all the changes can
be saved in one postback.

To track which controls user has made modification, the control needs a
customized BoundField class to work with various controls. Currently it
doesn't have support for RadioButtonList, but I think this should be easy
to add support for it since it's similar to the DropDownList. Please refer
to the DropDownField class for more information. Please feel free to let me
know if you have questions while adding RadioButtonList to it.
Walter Wang (wa****, remove 'online.')
Microsoft Online Community Support

Get notification to my posts through email? Please refer to
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at

This posting is provided "AS IS" with no warranties, and confers no rights.

Jan 2 '07 #2

P: n/a
Hi Walter,

I actually found Matt's article a couple of days ago, and this is what I
implemented. (Except I'm only always dealing with 17 rows of data, so I
always just update them all without bothering to check which ones actually
need updating).

Jan 2 '07 #3

P: n/a
Hi cpnet,

Thanks for the update. Let me know if have any other questions.

Walter Wang (wa****, remove 'online.')
Microsoft Online Community Support

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

This posting is provided "AS IS" with no warranties, and confers no rights.

Jan 3 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.