[英]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.