[英]GridView - add formatted child rows from Ajax call that matches the rendered grid
I have an asp.net webforms site with a rather large GridView. 我有一个带有相当大的GridView的asp.net Webforms网站。 The GridView is rendered from a filtered list of data objects.
GridView是从过滤后的数据对象列表中呈现的。
Some of the data objects have children of the same type. 一些数据对象具有相同类型的子代。
In my GridView, I'm initially only showing the parent objects. 在我的GridView中,最初只显示父对象。 I want to be able to expand the parent to show the child objects, via an Ajax call, and insert the new rows under the parent.
我希望能够通过Ajax调用扩展父对象以显示子对象,并在父对象下插入新行。
The catch is, they need to follow the same formatting and rendering rules as the parent, and fit in with all the rest of the existing rows. 要注意的是,他们需要遵循与父代相同的格式和呈现规则,并适合所有现有的其余行。 This means that all columns of the new child needs to fit in the columns of the rest of the rendered grid.
这意味着新子级的所有列都需要适合渲染网格其余部分的列。
I would also like to re-use the existing GridView rendering methods if possible, so I don't have to maintain duplicate code that essentially does the same thing. 如果可能的话,我还想重用现有的GridView渲染方法,因此我不必维护本质上可以做同样事情的重复代码。
I can easily use the DynamicPopulateExtender from the AjaxControlToolkit to call a web service to get the child rows, but that wouldn't easily give me the rendered and formatted HTML that would fit into the already rendered GridView table. 我可以轻松地使用AjaxControlToolkit中的DynamicPopulateExtender来调用Web服务以获取子行,但这不会轻易为我提供适合已呈现的GridView表的呈现和格式化的HTML。
Is there a way to get this to work properly, or is there a different way I should approach this? 是否有办法使它正常工作,或者有其他方法应解决?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.