Gridview和数据列表 [英] Gridview and Datalist

查看:66
本文介绍了Gridview和数据列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建主要详细格式
我有一个课程列表,学生参加的课程及其相应的付款结构(2个数据列表:1个用于待付款项,1个用于付款历史记录)

我在gridview中有已注册课程的列表.每行末尾都有一个按钮,用于显示相应的付款结构.

我想单击该按钮,并在gridview本身内的所选行下方显示付款结构.

基本上,我想知道如何在gridview中的所选行下方添加一个空行,而没有任何列(如页脚).这样我就可以使用模板并将控件放在其中.

我不想将数据列表控件放在列中,我希望它完全位于所选行的下方.

I am creating a master detail format
I have a list of courses, students enroll into,and their corresponding payments structures (2 datalists: 1 for pending payments, 1 for Payment History)

I have the list of courses enrolled in, in a gridview. And a button at the end of each row to dispplay the corressponding payment structure.

I want to click on the button and display the payment structure within the gridview itself, below the row selected.

Basically, i want to know how to add an empty row without any columns (like a footer) below the selected row in gridview. SO that I can then use templates and place my controls in it.

I do not want to place the datalist controls in columns, I want it to be completely under the row selected. Help please!

推荐答案

我能想到的唯一方法是编写大量JavaScript,将所需的行插入到客户端上的表格(这是一天结束时的呈现方式).在我能想到的任何服务器端代码中,gridview将不支持此功能.在很多方面,在这里中继器是一个更好的选择,它为您提供了对这种自定义操作的更多控制,但是,当然,您随后失去了gridview的功能.
The only way to do this that I can think of, is to write a lot of javascript to insert the row you want under the row in the table ( which is how it is rendered at the end of the day ), on the client side. The gridview will not support this, in any server side code I can think of. In a lot of ways, a repeater is a better option here, it gives you a lot more control for this sort of custom action, but, of course, you then lose the features of the gridview.


请按照以下步骤操作:
1-在gridview中为您的按钮设置C​​ommandName的值
2-在TemplateField中为各列定义EditTemplate并将数据列表放置在EditTempalte
3-在您的业务逻辑中的GridViewRowCommand事件处理程序中,键入用于所选行的数据的数据列表,然后显示该行的数据列表,并将EditIndex属性设置为网格中的选定索引,以显示该行的数据列表.
follow these steps please:
1- set a value for the CommandName for your button in the gridview
2- in the TemplateField define the EditTemplate for the columns and place your datalist in the EditTempalte
3- in the GridViewRowCommand event handler type in your business logic in order to load the datalists with data for the selected Row, then show the datalist for that row and set the EditIndex property to be the selected index from the grid in order to show the datalist for that row.


这篇关于Gridview和数据列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆