且构网

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

在ASP.NET C#中添加动态行

更新时间:2023-12-06 15:31:46

你需要使用 ViewState 时要小心,以避免页面性能问题。此外 ViewState 在大小方面有限制,因此请确保不要在其中存储大量数据。



如前所述,您可以使用JavaScript / jQuery在客户端添加动态控件。这样,所有交互只发生在浏览器上,因此您可以快速响应。只需谷歌使用jquery添加动态文本框来获取更多示例。这是我发现的一个:如何使用jQuery动态添加/删除文本框 [ ^ ]

Hi to all,
Here i want to add dynamic row in Gridivew. Here i done using Viewstate. But in my project Here i need to do some calculation look like sales or purchase Screen. and have Item dropdown To load and Item Have minimum 500 count. If i using Viewstate Grid should be Slow for 30 rows. Any Other suggestion to do Dynamic Grid be Fast(Here I need to add minimum 100 row of per Invoice).

What I have tried:

Here i done DynamicGridView Using Viewstate,FirstRow,SetPreviousRow,SetRowdata.

You need to be careful when using ViewState to avoid page performance issue. Also ViewState has a limit when it comes to size, so make sure that you don't store a huge amount of data in it.

As already suggested, you can use JavaScript/jQuery to add dynamic controls at the client. That way all interactions only happens at the browser, so you can have a fast response. Just google "adding dynamic textbox using jquery" to get more examples. Here's one I found: How to add / remove textbox dynamically with jQuery[^]