1

I have this Web Control call uc_Register.asxc Inside this web control got a Text Box i.e txtName

I add this Web Control into my web page call register.aspx

<%@ Register Src="~/controls/uc_Register.ascx" TagPrefix="ecommmbs" TagName="uc_Register" %>
<hr />
<ecommmbs:uc_SummaryCart runat="server" ID="uc_SummaryCart" />
<hr />

i want to get the value from txtName.txt from uc_Register.asxc at register.aspx. how to make this happen?

2 Answers 2

1

Try this in Register.aspx

TextBox txtbox = (TextBox)uc_Register.FindControl("txtName");

but keep in mind Page_Load() of aspx page is called first than Page_Load()of .ascx is called.

Sign up to request clarification or add additional context in comments.

Comments

0

Here is an example:

   Declare On User Control (PrevTransList2.ascx.cs)

    public string TransHxPage
      {
        get
        {
            return name;
        }
        set
        {
            name = value;
        }
       }

On Class file
   public interface IUserControlTransHx
    {
        string TransHxPage { get; set; }

    }
            txtSomthing.Text = TransHxPage;

Now On Web page SET its values

          PrevTransList2.TransHxPage = "POSP";

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.