Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have added a literal control in my visual web part VisualWebPart1.ascx file as follows:

<asp:Literal id="slider"></asp:Literal>

I am trying to access it in VisualWebPart1.ascx.cs file as follows but it is not working:

protected void Page_load(object sender, EventArgs e)
{
      slider.Text = "Testing";
}
share|improve this question
add comment

1 Answer

Fixed it by adding runat="server" attribute in literal. Silly mistake!

share|improve this answer
    
lol yes it is ;), without the runat=server it wouldnt be available within the .cs as thats run at the server :) –  ali Sharepoint Apr 8 '13 at 13:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.