简体   繁体   English

在ASP.NET中将控件动态绑定到网格视图

[英]Dynamically bind controls to the grid view in asp.NET

I just want to bind controls to the grid view but i want to do it dynamically.As an example i just want to enter students marks to text box to adjacent subjects?? 我只想将控件绑定到网格视图,但我想动态地进行。例如,我只想在文本框中输入学生的分数以标记相邻的主题?

thinks students are in row's and subjects are in columns and it similar to matrix in mathematics . 认为学生在行中,科目在列中,这类似于数学中的矩阵。 but some times no of students and no of subjects are vary. 但是有时候学生人数和科目都不一样。

Therefore i have to bind it dynamically CAN ANY ONE HELP ME WITH THIS 因此,我必须动态绑定它,任何人都可以帮助我

Use the RowDataBound event. 使用RowDataBound事件。 You can add any control there. 您可以在那里添加任何控件。

CheckBox cb = new CheckBox();
cells[0].Controls.Add(cb);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM