Click here to Skip to main content
15,893,814 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have web application in this am using user control to place it in the table according to row depend on count.Each row has one usercontrol and each usercontrol has 4 textboxes .I am not able to get any of text boxes in the usercontrol when i submit the page.however i am getting the row in which usercontrol placed how can i get the controls id,please have look in my code suggest if i have done any wrong.

C#
MasterPage ctl00 = FindControl("ctl00") as MasterPage;
ContentPlaceHolder cplacehld = ctl00.FindControl("ContentPlaceHolder1") as ContentPlaceHolder;
foreach (SeatBookDetails sff in SBD)
{
    TableRow trow = (TableRow)cplacehld.FindControl("Row_" + sff.SeatRowId.ToString() + "_" + sff.SeatRowno.ToString());
    if (trow != null)
    {
        TextBox txtcust = (TextBox)trow.FindControl("txtcustname");

        if (txtcust != null)
        {

      }
        TextBox txtprofession = (TextBox)trow.FindControl("txtprofession");
        if (txtprofession != null)
        {

        }
    }
}



This is the one of textbox id in usercontrol when page rendered ctl00_ContentPlaceHolder1_ctl00_txtcustname

and this is one of row id in which these textboxes reside ctl00_ContentPlaceHolder1_Row_1_10

please suggest any other way if it not going to work?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900