如何避免从页脚文本框中在gridview内的文本框中输入重复值。 [英] How to avoid entering duplicate values in textbox inside gridview from footer textboxes.

查看:72
本文介绍了如何避免从页脚文本框中在gridview内的文本框中输入重复值。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何避免从页脚文本框中在gridview内的文本框中输入重复值。

========================= ======================================



您好frnds,



我想避免从gridview页脚文本框输入重复值,如果该记录已存在于数据库中。它必须显示弹出消息。记录已存在。



我的gridview中有三列为UserName,Password,EmailAddress。



请问你能帮我怎么做。我在一周内尝试了很多,我无法找到确切的解决方案。



请提前帮助,谢谢。

How to avoid entering duplicate values in textbox inside gridview from footer textboxes.
===============================================================

Hi frnds,

I want to avoid entering duplicate values from gridview footer textboxes, if the record already exists in database. it must show a pop up message. Record already exists.

I have Three columns in my gridview as UserName,Password,EmailAddress.

Please can you help me how to do this. am trying a lot from one week, am unable to find the exact solution.

Please help, Thanks in advance.

推荐答案

我认为你在网格页脚中有'新记录部分'。

与UserName,Password,EmailAddress&保存按钮



并且您想限制保存重复记录,对吧?

当您单击保存按钮时,检查特定记录是否存在在数据库中与否。如果是,则显示警报或将记录保存到数据库。示例虚拟代码在下面



I think you have 'new record section' in grid footer.
Like UserName, Password, EmailAddress & Save button

And you want to restrict to save duplicate records, right?
When you click the Save button, check the particular record exists in database or not. If yes, show alert or save record to database. Sample dummy code is below

private void Save_Click()
{
 if(IsUserExists("UserName from grid textbox") == true)//Pass textbox value
 {
   //Show alert
 }
 else
 {
   //Save record to database
 }
}

private bool IsUserExists(string UserName)
{
//Logic for User exists in database or not
}



就是这样。


that's it.


这篇关于如何避免从页脚文本框中在gridview内的文本框中输入重复值。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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