简体   繁体   English

检查文本框以获取某些特定文本asp.net C#

[英]Check a textbox for some certain text asp.net c#

How do I check if a textbox contains "@mediacollege.dk" in like this 我如何检查文本框是否包含“ @ mediacollege.dk”?

if (email.text == "here it checks if it contains "@mediacollege.dk" and does a command")
{
    DHF_LodderTableAdapter DHFLodder = new DHF_LodderTableAdapter();
    DHFLodder.Insert(UserName.Text, 10);
}
else
{
    // nothing
}

You can do it as 你可以做到

if (email.text.Contains("@mediacollege.dk") )
 {
        // do your work
     DHF_LodderTableAdapter DHFLodder = new DHF_LodderTableAdapter();
     DHFLodder.Insert(UserName.Text, 10);    
}
else
{
    // nothing
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM