如何在ASp.net页面中动态创建表? [英] How to create Table Dynamically in ASp.net page ?

查看:112
本文介绍了如何在ASp.net页面中动态创建表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI All ..
我想为学校制定一个动态时间表.
但是主题和时间段不是固定的...因此可以有任意数量的行和列,这些行和列将由用户在运行时决定.

当用户根据表输入行数和列数时,将显示表放置量,并且我的表的每个单元格都将包含一个文本框,用户可以在其中编写内容..

当他单击保存"按钮时,整个表格将按原样保存....

我应该使用Gridview来满足我的需求吗? 请问您是否还有其他更好的想法来开发此工具,建议我以适当且丰富的方式完成此任务.....

在此先感谢

HI All..
I want to develop a dynamic time table for a school.
But the subjects and periods are not fixed ...so there can be any number of rows and columns in this which will be decided by user at runtime.

when user enters number of row and columns according to tha ta table layput will be displayed and Each cell of my Table will Contain a Textbox in which user can write somthing..

and when he clicks on save button the entire table will saved as it is....

should i use Gridview to accomplish my need ????
pls if u have any other better idea to develop this pls suggest me complete this task in a proper and rich way.....

thanks in advance

推荐答案

请参阅

如果不这样做不需要排序/分页等特定于网格的功能,那么我建议使用Table.从性能的角度来看,虽然可能会有一些额外的编码,但效果会更好.

步骤:
1.获取行数和列数.
2.使用这些列创建表.
3.一行一行地添加.在单元格中添加文本框.视图已准备就绪.
4.保存时,必须将数据保存为表格式,然后可以将其另存为XML以存储在DB中或存储在DB表中的单个项目中.
If you don''t need features specific to grid like sorting/paging etc then I would suggest to go with Table. From performance prospective it would be much better though a little bit of extra coding may be.

Steps:
1. Get the number of rows and columns.
2. Create the table with those columns.
3. Add row one-by-one. Add textbox in the cells. View is ready.
4. When you save, you have to save the data in a table format and then you can save it as an XML to store in DB or individual items in table in DB.


Hope [
Hope this[^] might help you.


这篇关于如何在ASp.net页面中动态创建表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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