开发者

Access problem to Hyperlink

开发者 https://www.devze.com 2023-03-23 21:02 出处:网络
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 hyperl

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 ?!

0

精彩评论

暂无评论...
验证码 换一张
取 消