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

Find control in RadPanelBar and assign it to new one

0 Answers 74 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Mohamed
Top achievements
Rank 1
Mohamed asked on 11 Apr 2013, 01:51 PM
Here's the working code:

In the page.aspx.cs, I define a static variable:

private static TextBox txtName;

 

In the Page_Load() event, I initialize it:

txtName = (TextBox)RadPanelBar1.FindItemByValue("Add").Controls[0].FindControl("TxtName");


The questions is:
1- I had to make the textbox "static" to make the code work, why?
2- The initialization code didn't work when I put it in the if (!IsPostBack) block, I had to make it run  in every page load. why? and is there a better approach to achieve the same functionality?

 

 

 

 

No answers yet. Maybe you can help?

Tags
PanelBar
Asked by
Mohamed
Top achievements
Rank 1
Share this question
or