gridview(刷新gridview和编辑行) [英] gridview (refresh gridview and edit row)

查看:61
本文介绍了gridview(刷新gridview和编辑行)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照此链接从gridview添加新记录。到目前为止它很好

但是我需要修改最后一块来编辑记录,我将提供记录ID


http:// asptutorials .net / ASP / gridview ... dit-blank-row /


我使用存储过程来插入新记录并返回id。

现在我可以在我的asp.net(c $)环境中获取id。我添加了一个标签

,我可以使用新添加的记录'

id填充标签。


我想使用这个新ID来跟踪代码进行编辑。另外,我的

gridview在添加新记录后没有刷新

(gridview2.databind()没有做到它应该做的事情)。


我想获取一行记录ID

而不是空行,并将其置于编辑模式。

I followed this link to add new record from gridview. So far it''s good
but I need to modify the last piece to edit the record that I will
supply the record id.

http://asptutorials.net/ASP/gridview...dit-blank-row/


I am using stored proc to insert a new record and returning the id.
Now I can get the id in my asp.net (c$) environment. I added a label
and I was able to populated the label with the newly added record''s
id.


I would like to use this new id to following code to edit. Also, my
gridview does not refresh after adding the new record
(gridview2.databind() not doing what it supposed to).


Instead of getting empty row, i would like to get a row by record id
and put it in edit mode.

展开 | 选择 | Wrap | 行号

推荐答案

)环境。我添加了一个标签

,我可以使用新添加的记录'

id填充标签。


我想使用这个新ID来跟踪代码进行编辑。另外,我的

gridview在添加新记录后没有刷新

(gridview2.databind()没有做到它应该做的事情)。


我想获取一行记录ID

而不是空行,并将其置于编辑模式。
) environment. I added a label
and I was able to populated the label with the newly added record''s
id.


I would like to use this new id to following code to edit. Also, my
gridview does not refresh after adding the new record
(gridview2.databind() not doing what it supposed to).


Instead of getting empty row, i would like to get a row by record id
and put it in edit mode.
展开 | 选择 | Wrap | 行号


好的。您帖子中的大量陈述。不过没问题。你需要帮助什么部分?你有什么错误?你到目前为止尝试了哪些变化已经接近但不完全?
Ok. Lots of statements in your post. No questions though. What part do you need help with? What error are you getting if any? What variations have you tried so far that has been close, but not quite?


我有2个问题。


1.我的数据网格不是插入记录后刷新。

2.我想在刚刚插入的编辑模式下打开记录。我回来了。 (参考我帖子的最后一段)。我将此行更改为此GridVIew1.DataKeys [r] .Values [1] .ToString()== id)但不起作用。得到错误。


这是代码
I having 2 issues.

1. My datagrid is not refreshing after I insert a record.
2. I would like to open the record in edit mode that i have just inserted. I am getting the id back. (refering to last paragraph of my post). I change this line to this GridVIew1.DataKeys[r].Values[1].ToString() == id) but not working. getting error.

Here is the code
展开 | 选择 | Wrap < span class =codeDivider> | 行号


这篇关于gridview(刷新gridview和编辑行)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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