Click here to Skip to main content
15,867,330 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Sir,
I want to run java script function in content page,i;m using below code.

ASP.NET
<%@ Page Title="" Language="C#" MasterPageFile="~/newmobi.master" AutoEventWireup="true" CodeFile="Default10.aspx.cs" Inherits="Default10" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:Panel ID="Panel1" runat="server">
       <asp:Image ID="img1" runat="server" Height="75px" 
            ImageUrl="~/images/User-icon.png" Width="75px"  onmouseover="document.getElementById('lnkbtn2').style.display = 'block';"
             onmouseout="document.getElementById('lnkbtn2').style.display = 'none';"/>
        <asp:LinkButton ID="lnkbtn2" runat="server" style="display:none;" onmouseover="document.getElementById('lnkbtn2').style.display = 'block';"
             onmouseout="document.getElementById('lnkbtn2').style.display = 'none';">Change Profile pic


but it's not work in this page,
but work in other aspx page (without master.aspx related page).
please help me.
Posted
Updated 2-Feb-14 20:04pm
v2

1 solution

try and use clientid property of the control. when you have a master page your control will not recognize by the same id that you write for this.


use

JavaScript
onmouseover="document.getElementById('<%=lnkbtn2.ClientID%>').style.display = 'block';"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900