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

cid = (string.IsNullOrEmpty(typeId) ? null : ( Convert.ToInt32( typeId)) ) 有

2013-02-15 
cid (string.IsNullOrEmpty(typeId) ?null : ( Convert.ToInt32( typeId)) )有@{var typeId Request.Q

cid = (string.IsNullOrEmpty(typeId) ? null : ( Convert.ToInt32( typeId)) ) 有


        @{var typeId = Request.QueryString["cid"];
          int? cid;
         cid = (string.IsNullOrEmpty(typeId) ?  null : ( Convert.ToInt32( typeId)) );
}


( Convert.ToInt32( typeId)) )   这一块下边出现红线,显示有错,该怎么写

因为有个函数里边有个 类型就是 int ?,所以我进行上边转换
[解决办法]
try

 cid = string.IsNullOrEmpty(typeId) ?  null : (int?) Convert.ToInt32( typeId);

热点排行