ASP.NET User Control Pass String Variable From Parent Codebehind?

I know how to pass a hard-code variable on the Parent aspx like this:

   <myControls:SignUpForm ID="SignUpForm" SubscriptionID = "1" runat="server" />

[SignUpForm.ascx.cs]
public partial class UserControls_SignUpForm : System.Web.UI.UserControl
{
        public string subscriptionID {get; set;}

        protected void Page_Load(object sender, EventArgs e)
        {
            string id = subscriptionID; //Works with hard-coded var
        }
}

Open in new window


However, I really need dynamic variables from a Repeater control on the same Parent page:
 
 Q1. Can I use the Repeater Eval variable directly?
 Q2. Can I use the Repeater Eval in the Parent codebehind?

[Repeater]
<asp:Repeater ID="rpSubscriptions" runat="server">
   <ItemTemplate>
      <asp:ImageButton ID="btnJoin" runat="server" 
                                       OnCommand="SelectPlan" 
                                       CommandArgument='<%# Eval("SubscriptionId") %>' 
                                       ImageUrl="~/images/join.png" />
      </ItemTemplate>
   </asp:Repeater>

Open in new window


This doesn't work!
     <myControls:SignUpForm ID="SignUpForm" SubscriptionID = '<%# Eval("SubscriptionId") %>' runat="server" />  

[Parent Codebehind] Not Working!
protected void SelectPlan(object sender, CommandEventArgs e)
{
       UserControls_SignUpForm form1 = new UserControls_SignUpForm();  
     
       form1.subscriptionId = e.CommandArgument.ToString();      
}
WorknHardrAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gary DavisDir Internet SvcsCommented:
Your SelectPlan() click event is allocating a new SignUpForm and setting  the subscriptionId property and then doing nothing with the new form.

You probably want to instead use the existing SignUpForm with ID SignUpForm instead of allocating a new one.

Then (I suspect) you probably want to do something with it.

Gary Davis
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
WorknHardrAuthor Commented:
Yes, how do I code that?
0
WorknHardrAuthor Commented:
THX
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.