I have two nested master page.I add a hyperlink in second master page and I want to change forecolor of hyperlink from a asp 开发者_如何转开发page that is connected to it.But,I can't access to hyperlink.
HyperLink hpl2 = (HyperLink)Master.FindControl("hplD") as HyperLink;
hpl2.ForeColor = Renk2;
After it works upper code,I got the following error.
Object reference not set to an instance of an object.
This error may happen either the Master property is null or because the find control didn't found the control so the hpl2 object is null. Can you tell which of them is correct ?!
精彩评论