我创建了一个 GridView,其列是根据我的数据源动态创建的。我已经使用描述的方法实现了这些列 此处。这些列在初始加载时正确显示。但是,我需要实现命令,以便用户可以编辑/删除 GridView 中的行。
此时,我已经像使用普通 GridView 一样实现了命令。我有一个带有 ItemTemplate 的 TemplateField,其中包含用于编辑和删除的 LinkButton 元素。每个 LinkButton 的 CommandName 分别设置为“编辑”或“删除”。
奇怪的是,当用户单击“编辑”或“删除”链接时,GridView 中的数据就会消失。但是,我已经验证,当选择这些 LinkButton 元素之一时,我实际上正在重新绑定数据。
任何人都可以提供一些关于可能原因的建议吗?
谢谢你!
I have created a GridView whose columns are dynamically created based on my data source. I have implemented these columns by using the approach described here.Those columns display properly on the initial load. However, I need to implement commanding so that a user can edit / delete a row in the GridView.
At this point, I have implemented commanding as I would with a normal GridView. I have a TemplateField with an ItemTemplate that has LinkButton elements for edit and delete. The CommandName for each LinkButton is set to either Edit or Delete respectively.
Oddly, when a user clicks either the Edit or Delete link, the data in the GridView disappears. However, I have verified that I am in fact re-binding the data when one of these LinkButton elements is selected.
Can anyone provide some suggestions as to what the cause could be?
Thank you!
发布评论
评论(1)
这里有一些很好的例子。您可以找出回发问题。
http://quickstarts.asp.net/QuickStartV20/aspnet/
Here are good examples. You can figure out postback issue.
http://quickstarts.asp.net/QuickStartV20/aspnet/