i think solved my problem but ...
i test below code ,this find contentplaceholder but not find my element.
ContentPlaceHolder mpContentPlaceHolder;
mpContentPlaceHolder = (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder2");
if (mpContentPlaceHolder != null)
{
Label mpLabel = (Label)Master.FindControl("IdTopic");
if (mpLabel != null)
{
ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowAlert();", true);
}
}
and insert
<%@ MasterType virtualPath="~/level2.Master"%>
but not work.
my refrence code is :
link
i use master page .
my code is into contetntplaceholder.
in content place holder have gridview.
my code is:
<asp:GridView ID="showPostrRGridView" runat="server" AutoGenerateColumns="false" Width="858px" OnSelectedIndexChanged="showPostrRGridView_SelectedIndexChanged" >
<Columns>
<asp:TemplateField>
<ItemTemplate>
<div id="BorderTopic" class="BorderTopic">
<div id="TopicView1" class="TopicView">
<asp:Label ID="IdTopic" runat="server" Text='<%# Eval("IDTopic") %>' Visible="false"></asp:Label>
<table style="width: 100%; height: 100%;">
<tr>
<td style="width: 4%; height: 100%;"></td>
<td style="width: 52%; height: 100%; border-left-color: black; border-left-style: solid; border-left-width: 0.5px;">
<div>
<table style="width: 100%; height: 100%;">
<tr style="width: 100%; height: 25%;">
<td>
<asp:LinkButton ID="linkToPost" Text='<%# Eval("titleTopic") %>' Font-Size="Large" Font-Names="b yekan" runat="server" ForeColor="#c6c574" OnClick="linkToPost_Click"></asp:LinkButton></td>
</tr>
<tr style="width: 100%; height: 25%;">
<td>
<asp:Label runat="server" Text='<%# Eval("Description") %>' Font-Size="Small" Font-Names="b yekan"></asp:Label></td>
</tr>
</table>
</div>
</td>
<td style="width: 40%; height: 100%;">
<div>
<table style="width: 100%; height: 100%;">
<tr>
<td style="width: 50%; height: 100%;">
<div>
<table style="width: 100%; height: 50%;">
<tr>
<td align="center">
<asp:Label runat="server" Text="تعداد مبحث های تاپیک" ID="lblMabhas" Font-Size="Large" Font-Names="b yekan" ForeColor="#c6c574"></asp:Label>
</td>
</tr>
<tr>
<td align="center" >
<asp:Label runat="server" Text='<%# Eval("NumOfPost") %>' Font-Size="Small" Font-Names="b yekan"></asp:Label>
</td>
</tr>
</table>
</div>
</td>
<td style="width: 50%; height: 100%;">
<div>
<table style="width: 100%; height: 50%;">
<tr>
<td align="center">
<asp:Label runat="server" Text=" ارسال آخرین مطلب" Font-Size="Large" Font-Names="b yekan" ForeColor="#c6c574"></asp:Label>
</td>
</tr>
<tr>
<td align="center">
<asp:Label runat="server" Text='<%# Eval("DatePost") %>' Font-Size="Small" Font-Names="b yekan"></asp:Label>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</td>
<td style="width: 4%; height: 100%;"></td>
</tr>
</table>
</div>
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>