Results 1 to 2 of 2

Thread: Master Page problem

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up 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
    Failing to plan is Planning to fail

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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 + "');");

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width