Here's the working code:
In the page.aspx.cs, I define a static variable:
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?