Posted on: 5/22/2015 7:15:45 PM | Views : 603

Hi Everyone,
I am trying to loop through A to Z and display links (with named anchor) on top of the page. I write code to bind the linkbutton to a placeholder dynamically.  If there is no data from database, then bind a literal to the placeholder. But I get an error message that
Object reference not set to an instance of an object. below is my code:
PlaceHolder a = (PlaceHolder)FindControl("atozlink"); LinkButton atoz = (LinkButton)FindControl("lnkatoz"); Literal atoz2 = (Literal)FindControl("litatoz"); for (char c = 'A'; c < 'Z'; c++) { if (clsNewList.HasLink(c)) { atoz = new LinkButton(); atoz.Text = c.ToString(); atoz.ID = c.ToString(); atoz.Attribute ...

Go to the complete details ...