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

Accessing PageView Labels

1 Answer 93 Views
PageView
This is a migrated thread and some comments may be shown as answers.
Voya Developer
Top achievements
Rank 1
Voya Developer asked on 23 May 2012, 05:36 PM
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

1 Answer, 1 is accepted

Sort by
0
Voya Developer
Top achievements
Rank 1
answered on 23 May 2012, 06:46 PM
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();
    } 
Tags
PageView
Asked by
Voya Developer
Top achievements
Rank 1
Answers by
Voya Developer
Top achievements
Rank 1
Share this question
or