asp.net - How access hyperlink control in a repeater i c# .net -


there repeater in program includin hyper link.i cant cess hyper link control.

<asp:hyperlink id="hyperlink15" runat="server" navigateurl="abc.aspx"> 

set enabled=false

so use

hyperlink = (hyperlink)repeater1.findcontrol("hyperlink15"); 

the hyper link enabled user , b... use code:

if (a && b) {     hyperlink link = (hyperlink)repeater1.findcontrol("hyperlink15");     link.enabled=true;     link.navigateurl="efg.aspx";  } 

but following error:

system.nullreferenceexception: object reference not set instance of object.

hyperlink = (hyperlink)repeater1.items[0].findcontrol("hyperlink15"); 

use above, , items contain index.

or

for (int count = 0; count < repeater1.items.count; count++)         {             hyperlink = (hyperlink)repeater1.items[count].findcontrol("hyperlink15");         } 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -