How to access templated controls in user control?

Discussion in 'ASP .Net Web Controls' started by Ajak, Dec 22, 2006.

  1. Ajak

    Ajak Guest

    Hello,

    I am making a user control containing ajax updateprogress control as below:-

    <%@ Control Language="vb" AutoEventWireup="false"
    CodeBehind="AjaxProgress.ascx.vb"
    Inherits="sbmb.AjaxProgress" %>

    <span id="spanTag" runat="server" class="ajaxprogress">
    <asp:UpdateProgress ID="UpdateProgress1" runat="server">
    <ProgressTemplate>
    <asp:Image ID="imgLoading" ImageAlign="AbsMiddle"
    ImageUrl="~/imej/loading.gif" runat="server" />
    <asp:Label ID="lblMessage" runat="server" />
    </ProgressTemplate>
    </asp:UpdateProgress>
    </span>

    The purpose is just to wrap updateprogress with span and assign cssclass
    "ajaxprogress" to force it to be positioned inline.

    In codebehind, I write a property LoadingMessage to set the text of
    lblMessage like this:-

    Method 1:
    CType(UpdateProgress1.Controls.FindControl("lblMessage"), Label).Text =
    value

    Method 2:
    Viewstate("msg") = value
    then in UpdateProgress1_Load event, I put
    CType(UpdateProgress1.Controls.FindControl("lblMessage"), Label).Text =
    Viewstate("msg")

    But both methods are not working! FindControl can't find lblMessage and
    return nothing!


    Therefore, does anyone know how to access the label lblMessage in
    ProgressTemplate of UpdateProgress?
    Ajak, Dec 22, 2006
    #1
    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. RA Scheltema
    Replies:
    3
    Views:
    380
    RA Scheltema
    Jan 6, 2004
  2. Marijn
    Replies:
    5
    Views:
    439
    Marijn
    Feb 13, 2004
  3. Replies:
    0
    Views:
    2,212
  4. Faizan Ahmed
    Replies:
    1
    Views:
    270
    John Saunders
    Jan 4, 2005
  5. Faizan Ahmed
    Replies:
    1
    Views:
    345
    John Saunders
    Jan 4, 2005
Loading...

Share This Page