-
Master Page problem
Hi friends,
I put single master page with multiple content pages. I call the function from
master page that "showContent()".
MasterPage.Master :
================
function ShowContentOne()
{
alert("enterInside");
var elemContentOne=document.getElementById('divCheckContent');
alert(elemContentOne);
elemContentOne.style.display='block';
elemContentOne.style.visibility='visible';
}
<div>
<input id="btnSumbit" type="button" runat="server" style="width:250px" onclick="ShowContentOne()" />
===========================================
this 'divCheckContent' is in content page two. But i cant get it. i call this function onclick in master page.
frmContentOne.aspx :
================
<div id="divContentOne" runat="server" style="display:none;background-color:Red;height:500px;width:500px">
</div>
I cant get the div id. The div id is null while i give in alert.
Hope ur's reply
Thanks
:)
-
Re: Master Page problem
When your page renders in your browser, do a view source on the page. You will see that the DIV's ID is not divContentOne but it something like frmContentOne_Ctl$00_divContentOne. You will need to modify your javascript call to match this.
First, change your javascript method to accept the ID of the DIV that you want. Then, modify the btnSubmit onclick to pass the correct DIV.
Code:
btnSubmit.Attributes.Add("onclick","ShowContentOne('" + divContentOne.ClientID + "');");