如何更新&插入操作执行相同的提交按钮单击..例如,在Gridview上执行操作 [英] How to Update & insert operation Perform On Same Submitbutton Click .. eg Operation Perform On Gridview

查看:78
本文介绍了如何更新&插入操作执行相同的提交按钮单击..例如,在Gridview上执行操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨......我是AspLearner的新手.....可以任何帮助......

谢谢你

Hi...i am New In AspLearner.....Can Any One Help....
ThankYou

推荐答案

我在这里回答了类似的问题 - 如何在同一个提交按钮上处理更新和插入命令 [ ^ ]

I have answered similar question here - How to handle update and insert command on same submit button[^]
引用:

你应该在HiddenField中有一些主键字段值。因此,如果它是现有记录,您可以获得一个大于0的Id,这意味着有效的ID。



因此,如果Id大于0 ,然后更新该记录,否则插入。

You should have some primary key field value in a HiddenField or something. So, if it is an existing record, you can get a Id which will be greater than 0, meaning a valid Id.

So, if Id is greater than 0, then update that record, else insert.


这篇关于如何更新&插入操作执行相同的提交按钮单击..例如,在Gridview上执行操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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