Link to home
Start Free TrialLog in
Avatar of -Dman100-
-Dman100-Flag for United States of America

asked on

bind to label or literal control

I have a user control with two label controls.  Is it possible to databind to a label or literal control either declaratively or programmatically?

I was trying to bind using the Eval expression in the text attribute, but that doesn't work.  I think that has to be within a databound control like gridview, formview, detailsview, etc.

Any help is greatly appreciated.
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Quotes.ascx.cs" Inherits="controls_Quotes" %>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("quote_text") %>'></asp:Label>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("quote_author") %>'></asp:Label>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
    OldValuesParameterFormatString="original_{0}" SelectMethod="getQuotes" 
    TypeName="Library.BLL.QuotesBL"></asp:ObjectDataSource>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Muhammad Ousama Ghazali
Muhammad Ousama Ghazali
Flag of Saudi Arabia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial