使用asp.net Gridview的AJAX问题 [英] AJAX Issue with asp.net Gridview

查看:68
本文介绍了使用asp.net Gridview的AJAX问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello导师,



我在asp.net中使用Gridview控件。我使用复选框一次删除多行。



以前我在GridView_RowDeleting事件中使用以下代码删除行(一次一个)



< big> Datatable.Rows.RemoveAt(index)

Datatable.AcceptChanges()






//之后我再次将网格绑定到更新的数据表





GridView.DataSource =数据表

GridView.DataBind()


这里索引是我正在删除的行的索引和dtInboxData.Rows.RemoveAt(0)数据表是我的数据表与gridview相关联。



现在我想使用相同的行删除多行,我循环选择的rowindexes来调用相同的



对于iCount = 0到asRwIndexes.Length - 1



''从网格中删除

Datatable.Rows.RemoveAt(asRwIndexes(iCount) - 2)

下一页



但此代码正在删除来自数据表但不在Gridview的HTML中呈现的行.Ex-该行从Datatable中删除但在我的页面的网格渲染的

ASPX中仍然可见。





PS:我正在使用Ajax调用来调用它。请指教。

Hello mentors,

I am using the Gridview control in asp.net.I am using checkboxes to delete multiple rows at a time.

Previously i was using the following code to delete rows(one at a time) in GridView_RowDeleting event

Datatable.Rows.RemoveAt(index)
Datatable.AcceptChanges()



//after that i was binding the grid again to the updated datatable


GridView.DataSource = Datatable
GridView.DataBind()

here index is the index of the row i was deleting and dtInboxData.Rows.RemoveAt(0)datatable is my datatable associated with the gridview.

Now i want to delete multiple rows using the same and i am looping around the selected rowindexes to call the same

For iCount = 0 To asRwIndexes.Length - 1

''remove from grid
Datatable.Rows.RemoveAt(asRwIndexes(iCount) - 2)
Next

But this code is removing the row from datatable but not rendering in the HTML of the Gridview.Ex- The row is removed from the Datatable but its still visible in the
ASPX of my page where Grid is rendering.


PS: I am using Ajax call to call this.Please suggest.

推荐答案

这可能会帮助你:

使用复选框在GridView中删除多行 [ ^ ]



也看一下类似的QA:如何删除Data Gridview控件中的多行 [ ^ ]
This might help you out:
Deleting multiple Rows in GridView using Checkbox[^]

also have a look on similar QA: How to delete Multiple rows in Data Gridview control[^]


嗨亲爱的



如果您使用更新面板,请尝试定义触发器。
hi dear

Please try to define trigger if you are using update panel.


这篇关于使用asp.net Gridview的AJAX问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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