繁体   English   中英

ASP.NET 4.0 HiddenFields

[英]ASP.NET 4.0 HiddenFields

HiddenField hidCurrentFooterLinks = (HiddenField)gvTaxonomy.FindControl("hidCurrentFooterLinks");
hidCurrentFooterLinks.Value = txtFooterLinkCurrentYear.Text;
HiddenField hidPreviousFooterLinks = (HiddenField)gvTaxonomy.FindControl("hidPreviousFooterLinks");
hidPreviousFooterLinks.Value = txtFooterLinkPreviousYear.Text;
txtFooterLinkCurrentYear.Text = "";
txtFooterLinkPreviousYear.Text = "";

这是我的代码。 我收到异常,例如Object reference not set to an instance of an object 请帮我。

很可能是找不到控件,您需要确保找到控件并且未返回空引用。

if ((hidCurrentFooterLinks != null) || (hidPreviousFooterLinks != null)) {  // DO SOMETHING   }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM