如何给出asp.net C#的验证? [英] how can given validation given for asp.net C#

查看:106
本文介绍了如何给出asp.net C#的验证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

try
{
  con.Open();
  ddlCountry.DataSource = cmd.ExecuteReader();
  ddlCountry.DataTextField = "CountryName";
  ddlCountry.DataValueField = "ID";
  ddlCountry.DataBind();

  if (ddlCountry.Items.Count > 1)
  {
    ddlCountry.Enabled = true;
  }
  else
  {
    ddlCountry.Enabled = false;
    ddlCity.Enabled = false;
  }
}

推荐答案

使用您的问题/评论我明白您想要在验证消息时触发验证消息ddl计数是否超过1.



所以我可以建议解雇我们通常使用的验证消息Page.Isvalid(),它们可以触发消息你也可以在方法执行时使用这些方法,或者你可以在ddl项目更改事件中使用这些方法。




/>
如果上述任何一点都没有对您的问题有帮助,请根据方案和要求详细说明您的问题。
With your Question/comments I understood that you want to fire the validation message when ever the ddl count is more than 1.

So what i can suggest is to fire the validation messages we generally use Page.Isvalid() and these can fire the messages too.

you can use these method whenever the method is executing or in you can place in the ddl item change event.

If none of the point's mentioned above doesn't helps to your question please elaborate your question with the scenario & requirements.


这篇关于如何给出asp.net C#的验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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