Change Form Control text on User Control

Discussion in 'ASP .Net' started by Steven K, Aug 18, 2004.

  1. Steven K

    Steven K Guest

    Hello,

    I am using a User Control (ctlHeader.ascx). My problem is that I can't
    change the text of my literal control "ltlPricingHeader" in the file
    MyPage.aspx. I can bring in the user control as long as it's static.

    Any help with this would be appreciated.

    --
    Thanks in advance,

    Steven



    ctlHeader.ascx
    --------------
    <div align="left"><table cellspacing="0" cellpadding="2" width="730"
    border="0">
    <tr><td ><div align="right"><asp:Literal id="ltlPricingHeader" text="no
    title" runat="server"/></div></td></tr>
    </table></div>




    MyPage.aspx
    -----------
    <%@ Page Inherits="nsInterlock.DataConnection" src="../../bin/cnnPricing.vb"
    Explicit="True" Debug="True"%>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.OLEDB" %>
    <%@ Import Namespace="System.Web.Mail" %>
    <%@ Register TagPrefix="Pricing" TagName="PricingHeader"
    Src="../../Controls/ctlHeader.ascx" %>

    Sub Page_Load(Sender As Object, E As EventArgs)

    If Not IsPostBack

    'Web Page Title
    ltlPricingHeader.Text = "go steven"

    ......

    <!-- Start Logo and information -->
    <Pricing:pricingHeader id="ctlHeader" runat="server"/>
    <!-- End Logo and information -->
    Steven K, Aug 18, 2004
    #1
    1. Advertising

  2. Steven K

    Rutger Guest

    Steven K wrote:

    > Hello,
    >
    > I am using a User Control (ctlHeader.ascx). My problem is that I can't
    > change the text of my literal control "ltlPricingHeader" in the file
    > MyPage.aspx. I can bring in the user control as long as it's static.
    >
    > Any help with this would be appreciated.
    >



    I think you should use a Get/Set cconstruction for changing.

    eg:
    private string LabelText;
    public string LabelText
    {
    get
    {
    return labelText;
    }
    set
    {
    labelText = value;
    }
    }

    And hen in the OnLoad event of the control:
    MyLabel.Text = labelText;

    //Rutger
    Rutger, Aug 19, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?REo=?=
    Replies:
    2
    Views:
    469
    =?Utf-8?B?REo=?=
    Dec 1, 2005
  2. Mad Scientist Jr
    Replies:
    0
    Views:
    635
    Mad Scientist Jr
    Mar 22, 2006
  3. Santosh
    Replies:
    1
    Views:
    930
    =?Utf-8?B?QXVndXN0aW4gUHJhc2FubmE=?=
    Aug 2, 2006
  4. Jonathan Wood

    User Control to Control Other User Control

    Jonathan Wood, Jan 24, 2010, in forum: ASP .Net
    Replies:
    4
    Views:
    542
    Jonathan Wood
    Feb 2, 2010
  5. apparker
    Replies:
    10
    Views:
    370
    apparker
    Apr 3, 2007
Loading...

Share This Page