YoucreateaWebpagenamedTestPage.aspxandausercontrolnamedTestUserControl.ascx.TestPage.aspxusesTestUserControl.ascxasshowninthefollowinglineofcode.OnTestUserControl.ascx,youneedtoaddaread-onlymembernamedCityNametoreturnthevalue"NewYork".Youalsomustaddcodeto

题目

YoucreateaWebpagenamedTestPage.aspxandausercontrolnamedTestUserControl.ascx.TestPage.aspxusesTestUserControl.ascxasshowninthefollowinglineofcode.OnTestUserControl.ascx,youneedtoaddaread-onlymembernamedCityNametoreturnthevalue"NewYork".YoualsomustaddcodetoTestPage.aspxtoreadthisvalue.Whichtwoactionsshouldyouperform?()

A.AddthefollowinglineofcodetotheTestUserControl.ascx.cscode-behindfile.publicstringCityName{get{return"NewYork";}}

B.AddthefollowinglineofcodetotheTestUserControl.ascx.cscode-behindfile.protectedreadonlystringCityName="NewYork";

C.AddthefollowingcodesegmenttotheTestPage.aspx.cscode-behindfile.protectedvoidPage_Load(objectsender,EventArgse){strings=testControl.CityName;}

D.AddthefollowingcodesegmenttotheTestPage.aspx.cscode-behindfile.protectedvoidPage_Load(objectsender,EventArgse){strings=testControl.Attributes["CityName"];}


相似考题