Accessing PageView Labels

2 posts, 0 answers
  1. Benjamin
    Benjamin avatar
    3 posts
    Member since:
    Oct 2010

    Posted 23 May 2012 Link to this post

    I have a page where I am using a NestedViewTemplate with a RadTabStrip, RadMultiPage, and two RadPageViews.

    I have labels in RadPageView2 that I would like to get the text from in my code behind, so I can convert their values to integers to calculate in a formula that will then update another label's text in the same PageView. My questions are:

    1. How can I get the text value of a label in my codebehind where the label resides in my second PageView?
    2. How do I update the text value of a label in my second PageView from my codebehind?

    A non working example of what I was trying is the following:

    protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)
        {
            if (e.Tab.Text.Equals("Tab Text"))
            {
               e.Tab.PageView.FindControl("myLabel").Text = "Created from Code Behind";
            }
        } 

    Kind regards,

    Ben
  2. Benjamin
    Benjamin avatar
    3 posts
    Member since:
    Oct 2010

    Posted 23 May 2012 Link to this post

    I solved this in case anyone wants to know:

    protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)
        {
            Label IMPACT_ID_LABEL = e.Tab.PageView.FindControl("IMPACT_ID_LABEL") as Label;
            int rawImpact = 0;
            rawImpact = Convert.ToInt32(IMPACT_ID_LABEL.Text);
            Label myLabel = e.Tab.PageView.FindControl("myLabel") as Label;   
            myLabel.Text = rawImpact.ToString();
        } 
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top