且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在c#中进行数据绑定后在转发器中添加空行

更新时间:2023-12-03 16:00:40

在绑定情况下你唯一能做的就是向你绑定的数据源中添加空行转发器。



空行,我的意思是行中的每个值必须适合该字段才能表示空行。您不能只将null添加为行并期望它行。该行必须包含该行的一组完整值。


您可以通过客户端脚本执行此操作。

例如:

假设你有这个:

 <      id   =  myTable >  
< tbody >
< tr > ... < / tr >
&lt ; tr > ... < / tr >
< / tbody >
< / table >



你可以像这样在这个表中添加更多行(使用jquery)

 


' #myTable tr:last')。after(' < tr> ...< / tr>< tr> ...< / tr>');


Hi guys,

i'm working on repeaters, where i have bind it already.

but i want to add some more empty rows to the repeater.

suppose after binding if there are 6 rows, i want to make
it 10 rows[4 empty rows].

after binding the data to the repeater, the rows will be.. 4 or 5 or 6 or 1 or 2 or not known,
i want to make it as default to 10 rows, so that it look good, all the time.

using c#.

is it possible.

if yes, plz let me know

Thanks

The only thing you can do in a binding situation is to add empty rows to the data source you bound the repeater to.

By "empty rows", I mean each value in the row must be appropriate to that field to represent an empty row. You can't just add null as the row and expect it to row. The row must contain a full set of values for the row.


You can do it via client-side scripting.
For example:
Assumed you have this:
<table id="myTable">
  <tbody>
    <tr>...</tr>
    <tr>...</tr>
  </tbody>
</table>


You can add some more rows to this table like this (using jquery)



('#myTable tr:last').after('<tr>...</tr><tr>...</tr>');