2011-03-31 42 views
0

我想禁用基於可變禁用文本框爲必填項驗證控制

if(var==null) 
{ 
    //Activate it 
} 
else 
{ 
    //disable it 
} 

一些條件文本框中requiredfield驗證控件有一個人可以幫助我的代碼

+1

你的問題有你的答案 – 2011-03-31 09:39:51

回答

4
if(var == null) 
{ 
    requirefieldvalidator1.Enabled = true; 
} 
else 
{ 
    requirefieldvalidator1.Enabled = false; 
}