This is a migrated thread and some comments may be shown as answers.

Wizard load on demand Pass value to user control via public property

1 Answer 89 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Atlas
Top achievements
Rank 1
Atlas asked on 18 Sep 2010, 02:04 AM
In your Tabstrip Application Scenarios Wizard example,
http://demos.telerik.com/aspnet-ajax/tabstrip/examples/applicationscenarios/wizard/defaultcs.aspx 
you are doing:
public partial class DefaultCS : System.Web.UI.Page
   {
       protected void Page_Load(object sender, System.EventArgs e)
       {
           if (!Page.IsPostBack)
           {
               AddTab("Personal Info", true);
                 
               RadPageView pageView = new RadPageView();
               pageView.ID = "Personal";
               RadMultiPage1.PageViews.Add(pageView);
               AddTab("Education Info", false);
               AddTab("Professional Info", false);
           }
       }
         
       private void AddTab(string tabName, bool enabled)
       {
           RadTab tab = new RadTab(tabName);
           tab.Enabled = enabled;
           RadTabStrip1.Tabs.Add(tab);
       }
       protected void RadMultiPage1_PageViewCreated(object sender, RadMultiPageEventArgs e)
       {
           Control pageViewContents = LoadControl(e.PageView.ID + "CS.ascx");
           pageViewContents.ID = e.PageView.ID + "userControl";
           e.PageView.Controls.Add(pageViewContents);
       }

Is it possible to pass a variable to the user control when it loads without too much hacking?
A public property in the user control that I could use in the code above would be ideal.
I am currently using a session, but I want to convert the session to an encrypted Query string variable.
Each of the tabs needs access to the value and I would rather not have to write request.querystring code into each tabbed page.

1 Answer, 1 is accepted

Sort by
0
Atlas
Top achievements
Rank 1
answered on 18 Sep 2010, 03:02 AM
I figured it out I created a textbox on the page that calls the user control, made it invisible and added the following code to the page load of the user control:
protected void Page_Load(object sender, EventArgs e)
       {
           TextBox txtId = Parent.FindControl("txtId") as TextBox;
           if (txtId != null && !string.IsNullOrEmpty(txtId.Text))
               int id = Convert.ToInt32(txtId.Text);
           else
               Response.End();
       }
Tags
TabStrip
Asked by
Atlas
Top achievements
Rank 1
Answers by
Atlas
Top achievements
Rank 1
Share this question
or