Change Form Control text on User Control

S

Steven K

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 -->
 
R

Rutger

Steven said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top