ASP.NET - Get gridview edit row to span across columns

喜欢而已 提交于 2019-12-11 09:43:59

问题


I've got a grid control with 6 columns. I use the EditItemTemplate fields to display edit data and I'd like to customize this if possible. Right now, the EditItemTemplate will show any control that I put in there but it only displays it in the column in which the template is in. How can I get it to span across all 6 columns? For instance, the 6 columns are:

First Name | Last Name | Address | City | State | Zip

and when the user clicks the Edit button (in each row), I'd like to show those 6 for edit, but add 1 more control on a row below that, which spans all 6 columns:

First Name | Last Name | Address | City | State | Zip
------------------------------------------------------
UserComments
------------------------------------------------------

Any ideas how I can accomplish this or even if it can be done?


回答1:


You can modify the gridview control by hooking up to the OnRowCreated event.

I found a very comprehensive tutorial here: Rows and Columns Merging in ASP.NET GridView Control

In the posted article, the author takes a gridview like this:

And transforms it to this:



来源:https://stackoverflow.com/questions/9536089/asp-net-get-gridview-edit-row-to-span-across-columns

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!