c# - Access Master Page/Child Page Controls from My Class -
i have div on master page , want use showing page errors. have error display class , works fine. problem in instances, error gets displayed before tag resulting in (non)-display of message. code has response.redirect.
i want counter having error shown on div within master page (hoep helps).
how can access <div id="errorsegment" runat="server">
?
you can use findcontrol
method on class inherits system.web.ui.control
. includes master pages, pages , usercontrols. instance, page class, do:
htmlgenericcontrol errordiv = (htmlgenericcontrol)master.findcontrol("errorsegment");
the other thing remember using findcontrol
controls in asp page arranged in control tree structure. means need call findcontrol
on right node in tree (typically page or masterpage).
Comments
Post a Comment