how to find contentplace holder inside nested master page

Posted by Shanky11 under ASP.NET on 7/8/2014 | Points: 10 | Views : 1137 | Status : [Member] | Replies : 1
I am working on a project school erp.
In that thre is five text box i want to use foreach loop to insert all text box value in database
how can i find contentplace holder to get textboxes
<%@ Page Title="" Language="C#" MasterPageFile="~/SingleSubMasterPage.master" AutoEventWireup="true" CodeFile="Performance.aspx.cs" Inherits="Performance_Performance" %>

<%@ MasterType VirtualPath ="~/SingleSubMasterPage.master" %>
<%@ Reference VirtualPath ="~/SingleMaster.master" %>

Pleas help me out
i am using this code but contenplace holder is null..........
/foreach (Control c in contentPlaceHolder.Controls)
//{
// string parameter = "";
// Bll bll = new Bll();
// if (c is TextBox)
// {
// TextBox tb = c as TextBox;
// parameter = tb.Text;
// bll.InsertPerformanceMaster(ddlPerformanceAssesment.SelectedItem.Text.ToString(), parameter);
// }
// else
// {

// }
//}

lblperformance.Text = "Successfully Submitted......";
}





Responses

Posted by: Vuyiswamb on: 7/8/2014 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
try something like this


mpContentPlaceHolder = (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1");

foreach (Control c in mpContentPlaceHolder.Controls)

{


//what ever

}


Thank you for posting at Dotnetfunda
[Administrator]

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response