如何从asp.net的gridview中清除所有行 [英] how to clear all rows from gridview in asp.net

查看:175
本文介绍了如何从asp.net的gridview中清除所有行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web表单,从下拉列表中选择System Name(系统名称),所有显示在gridview1中的硬件名称,现在,我从dropdownlist2选择后,使用dropdownlist2,并在GridView2中添加ADD按钮选择显示的硬件列表时,我可以添加gridview2中有多行.现在,在按下保存按钮的同时,所有GridView2记录都保存在显示在gridview1中的数据库中.现在我想将gridview2保存在数据库中并在按下Save按钮的同时显示在gridview1中,GridView2的所有行都应该清除.

请帮助我找出解决方案,如果我能得到代码的话,更好.
在Advance中致谢

I have a web form on that while selecting, System Name from drop down list all install hardware name displayed in gridview1, now i using dropdownlist2 after selecting from dropdownlist2 and while adding ADD button selected hardware list displaying in GridView2, i can Add multiple rows in gridview2. Now while pressing save button all the GridView2 records Saved in database displaying in gridview1. Now I want Save gridview2 in database and display in gridview1 while pressing Save button, All the rows of GridView2 should get clear.

Please help me to find out the solution, better if i will get the code.
Thanks in Advance

推荐答案

如果要清除GridView,请删除数据源

If you want to clear a GridView you remove the datasource

GridView.DataSource = null;



对于使用下拉菜单和网格执行更复杂的操作的人而言,这极其容易.是吗?



Extremely easy for one who done more complicated operations with dropdowns and grids. Did you?


这篇关于如何从asp.net的gridview中清除所有行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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