简体   繁体   English

在运行时向 Gridview 动态添加行

[英]Dynamically Add a Row to a Gridview at Runtime

Is it possible to add a row to a gridview at runtime?是否可以在运行时向 gridview 添加一行? I need to add a default row(sometimes) and then add an adhoc row after the bound row based on a value in the bound row.我需要添加一个默认行(有时),然后根据绑定行中的值在绑定行之后添加一个临时行。

gridView.DataSource = source;
/// Create a new Default Row here
gridview.DataBind();

AND

OnDataBound(object sender, DataGridEventArgs e)
//evaluate each row and if certain criteria add a new row.

This might solve your problem. 可能会解决您的问题。

It would be easier to determine if you need to add additional rows before databinding.在数据绑定之前确定是否需要添加其他行会更容易。

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

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