当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

    摘要: 我使用ole显示word文件,但是如果用户的机器上没有word怎么办? 我怎样判断机器上是否有word? ......
    摘要: procedure tfrom1.dbgrid1keypress(sender:tobject;var key:char); begin if key=#13 then if not (activecontrol is tdbgrid)then begin key:=#0;//忽略enter键 perform(wm_nextdlgctl,0,0);//到下一控件 end else if......


怎样控制RequirdFieldValidator 何时响应不是用CauseValidate属性

我想实现这种功能:  
   
  如果用户再一个DropDownList里选了指定的项,那么就激发RequirdFieldValidator控件对一个TextBox里面得值进行非空验证,而如果选了其它的项的话就不验证。因为是在一个控件里进行条件判断的,所以好像不能用CauseValidate属性。而用CustomerValidator控件的话对于空值是默认正确的!!不知道各位有什么好的实现方法!  
 

NO.1   作者: saucer

use   client   side   javascript   in   WebUIValidation.js,   for   example,   the   following   validates   txt1   control   when   you   select   2   from   the   dropdownlist:  
   
  <form   runat="server">  
  <asp:TextBox   id="txt1"   runat="Server"   />  
  <asp:RequiredFieldValidator   id="val"   ControlToValidate="txt1"   ErrorMessage="required"   runat="server"   />  
  <asp:DropDownList   id="DropDownList1"   runat="server"   onchange="testValid()">  
  <asp:ListItem   Text="0"   Value="0"   />  
  <asp:ListItem   Text="1"   Value="1"   />  
  <asp:ListItem   Text="2"   Value="2"   />  
  <asp:ListItem   Text="3"   Value="3"   />  
  </asp:DropDownList>  
  <asp:Button   id="btn"   Text="click   me"   runat="server"/>  
  </form>  
  <script   language="javascript">  
  function   testValid()  
  {  
          var   dropdown   =   document.all("DropDownList1");  
          var   validator   =   document.all("val");  
          if   (dropdown.selectedIndex   ==2)  
          {  
  validator.isvalid   =   validator.evaluationfunction(validator);  
          }  
          else  
          {  
  validator.isvalid   =   true;  
          }  
          ValidatorUpdateDisplay(validator);  
  }  
  </script>


 ·datetime字段的插入问题    »显示摘要«
    摘要: 我有个数据表它里面有个datetime字段是允许为空的,如果用户在textbox中不输入任何数据,我应该怎么保存呢?相应的sql语句如下,请问该如何解决 insert into 航材库自控设备 (编号, 生产厂, 出厂日期, 使用日期, 安装地点) values (@部队编号, @生产厂, @出厂日期, @使用日期 ,@安装地点) ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE