首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

Request.Form的有关问题

2012-01-28 
Request.Form的问题用Request.Form接收一个不存在的表单,如何防止出错,是用if(Request.Form[ nothing ]n

Request.Form的问题
用Request.Form接收一个不存在的表单,如何防止出错,
是用if   (Request.Form[ 'nothing ']   ==   null)来判断,或者有其它通用的方法或函数呢

[解决办法]
if(Request.Form[ 'nothing '] != null && Request.Form[ 'nothing '].Trim() != " ")
or
if(null == Request.Form[ 'nothing '] || Request.Form[ 'nothing '].Trim() == " ")

热点排行