I have an aspx page, that is binding dynamic tabs from User Control Page. The code is as follows:
TabPanel tbPanel;
foreach (var personInfo in personsList)
{
tbPanel = new TabPanel();
tbPanel.ID = "TabPanel" + personInfo.PersonCode;
tbPanel.HeaderText = personInfo.FirstName + " " + personInfo.LastName;
tbPanel.ContentTemplate =
Page.LoadTemplate("~/UserControl/UCPartnershipStatementFull.ascx");
tbContainer.Tabs.Add(tbPanel);
}
Earlier, the User Control page just used to display some set of data based on backend calculations.
Now, the requirement is to add some text boxes on the User Control page, and then fetch it's value (as entered by user) and store in database, making it just like a form page.
I am having trouble fetching the textbox value from User Control page. When I do textbox.Text on the master aspx page, it gives null.
Please let me know if I can fetch the textbox value either on aspx.cs page or the User Control(ascx.cs) page? And How?
What I have tried:
Textbox added on UCPartnershipStatementFull.ascx:-
<asp:textbox runat="server" id="txtPtrTradeProfessionProfitFPS" enabled="true" cssclass="form-control" value="0.00">
On UCPartnershipStatementFull.ascx.cs page:-
protected void Page_Load(object sender, EventArgs e)
{
string a = txtPtrTradeProfessionProfitFPS.Text;
}