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

RadPanelBar inside DataBoundFormView loses RadTextBox binding

2 Answers 49 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
John Spinney
Top achievements
Rank 1
John Spinney asked on 20 Aug 2010, 08:15 PM
I have a bound FormView that contained a series of controls including a bound RadTextBox.  For usability I placed a RadPanelBar inside the FormView and within the ItemTemplate moved the textBox.  The binding no longer is respected.  Should the binding have been preserved or what steps must be done to re-establish the binding?
Regards.

2 Answers, 1 is accepted

Sort by
0
Cori
Top achievements
Rank 2
answered on 23 Aug 2010, 06:35 PM
I don't think that will work since the RadTextBox is now inside of  a different container, RadPanelBar, which is not bound to the data the FormView is. So I don't think it's possible to do that.
0
Kalina
Telerik team
answered on 24 Aug 2010, 03:28 PM
Hi John,

Indeed you cannot use declarative databinding in the scenario that you describe.

However you can handle the FormView.DataBound event, find the RadPanelBar within the ItemTemplate, and use the FindItemByValue PanelBar method to find the exact item. Then obtain the RadTextBox control instance and set the text explicitly:
protected void FormView1_DataBound(object sender, EventArgs e)
{
    if (FormView1.CurrentMode == FormViewMode.ReadOnly)
    {
        DataRowView itemData = (DataRowView)FormView1.DataItem;

        RadPanelBar RadPanelBar1 =
                 (RadPanelBar)FormView1.FindControl(
"RadPanelBar1");

        RadPanelItem panelItem1 =
                  RadPanelBar1.FindItemByValue(
"RadTextBoxHolder");

        RadTextBox RadTextBoxProductName =
           (RadTextBox)panelItem1.FindControl("RadTextBoxProductName");

        RadTextBoxProductName.Text = itemData["ProductName"].ToString();
 
       ...
       ...
    }
}

Please find more details at the sample page attached.

All the best,
Kalina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
PanelBar
Asked by
John Spinney
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
Kalina
Telerik team
Share this question
or