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

这是我的代码。我得到 Exception like Object reference not set to an instance of an object。请帮我。

4

1 回答 1

0

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

if ((hidCurrentFooterLinks != null) || (hidPreviousFooterLinks != null)) {  // DO SOMETHING   }
于 2011-11-08T11:05:16.007 回答