obtain a control value

2 posts, 0 answers
  1. gonzalez
    gonzalez avatar
    3 posts
    Member since:
    Sep 2010

    Posted 22 Jun 2015 Link to this post

    when I create a dynamically control within RadWizard, for example:

    // Code Behind

    Label mylabel = new Label ();             

    myetiqueta.ID = "lbl" + step.UniqueID; // step is a variable type RadWizardStep             

    etiqueta.Text = "Any Value"             

    step.Controls.Add (label); // Add control

    if I want to access control in the code behind, for example

    RadWizard.WizardSteps [0] .Controls [0];
    I do not have access to control, is there any solution?

  2. Plamen
    Admin
    Plamen avatar
    2731 posts

    Posted 23 Jun 2015 Link to this post

    Hello,

    The added control doesn't have to be the first in the collection so we would rather recommend using FindControl.Here is the code that worked correctly at my side:
    protected void Page_Load(object sender, EventArgs e)
       {
           Label mylabel = new Label ();            
               mylabel .ID = "lbl" ; // step is a variable type RadWizardStep            
               mylabel.Text = "Any Value";        
               RadWizardStep1.Controls.Add (mylabel); // Add control
               Response.Write(((Label)RadWizard6.WizardSteps[0].FindControl("lbl")).Text);
       }

    Hope this will help you solve the issue.

    Regards,
    Plamen
    Telerik
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top