|
-
Sep 30th, 2008, 06:18 AM
#5
Thread Starter
Addicted Member
Re: How get contentplaceholder id using javascript
frmMasterPage.Master:
==================
<form id="form1" runat="server">
<asp:ScriptManager ID="scriptManager1" runat="server">
</asp:ScriptManager>
<script type="text/javascript" language="javascript">
function ShowContentTwo() //while set as start page is frmContentTwo.aspx
{
alert("from two content");
this.id="frmMasterPage";
alert(this.id);
var elemId=document.getElementById('<%=form1.FindControl("ContentPlaceHolder2").ClientID%>');
//var elemId=document.aspnetForm.frmMasterPage_ContentPlaceHolder2;
alert(elemId);
elemId.style.display='block';
elemId.style.visibility='visible';
alert("from master two");
call()
}
</script>
<div>
<asp:UpdatePanel runat="server">
<ContentTemplate>
<a id="anchorLinkOne" runat="server" href="javascript:void(0)" onclick="ShowContentOne1()" style="color: blue; text-decoration: underline;cursor ointer">Div One</a>
</ContentTemplate>
</asp:UpdatePanel>
<br />
<asp:UpdatePanel runat ="server" >
<ContentTemplate>
<a id="anchorLinkTwo" runat="server" href="javascript:void(0)" onclick="ShowContentTwo()" style="color: blue; text-decoration: underline;cursor ointer">Div Two</a>
</ContentTemplate>
</asp:UpdatePanel>
<br />
</div>
<div>
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>
<asp:ContentPlaceHolder ID ="ContentPlaceHolder2" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
frmContentPageOne.aspx :
===================
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div id="divContentOne" runat="server" style="display:none;background-color:Red;height:500px;width:500px">
</div>
</asp:Content>
frmContentTwo.aspx :
=================
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<div id="divContentTwo" style="display:none;background-color:Green;height:500px;width:500px">
</div>
</asp:Content>
Failing to plan is Planning to fail 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|