Congratulations to all the winners of April 2013, they have won INR 3400 cash and INR 20147 worth prizes !
Go to DotNetFunda.com
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 11548 |  Welcome, Guest!   Register  Login
Home > Tutorials > ASP.NET Tutorials > Literal

Silverlight Tutorials | Report a Bug in the Tutorial
Found interesting? Add this to:


asp:Literal control
Literal control is the rarely used control which is used to put static text on the web page.
 
Ideally Literal control is the rarely used control which is used to put static text on the web page. When it is rendered on the page, it is implemented just as a simple text.
Unlike asp:Label control, there is no property like BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height etc. of Literal control. That makes it more powerful, you can even put a pure HTML contents into it.
DEMO : Literal Show Source Code
Ex. Just a text inside Literal Control
            <tr>
                <td>
                    <asp:Label ID="Label1" AssociatedControlID="dropStatic" runat="Server" Text="Select color to change the background color the cell"></asp:Label>
                     <asp:DropDownList ID="DropDownList1" runat="server">
                        <asp:ListItem Text="Red" Value="red"></asp:ListItem>
                        <asp:ListItem Text="Blue" Value="blue"></asp:ListItem>
                        <asp:ListItem Text="Green" Value="green"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:Button ID="Button1" runat="Server" OnClick="ChangeBackColor" Text="Change Label Text" />                
                </td>
                
                // Set the background color of the cell from server side event
                <td <asp:Literal ID="Literal2" runat="Server" />>
                    Ex. <asp:Literal ID="Literal3" runat="Server" Text="Just a text inside Literal Control"></asp:Literal>
                </td>
            </tr>
            
            
            // CODE BEHIND 
            // Fires when Button is clicked
            protected void ChangeBackColor(object sender, EventArgs e)
            {
                Literal1.Text = " bgcolor='" + dropStatic.SelectedValue + "'";
                litText.Text = "<div style='background-color:white;color:#000000'>Literl Control is powerful</div>";
            }
                    





About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/19/2013 6:31:31 PM