Hi, Usercontrol have a button with id=hdnBtn as below, <pre lang="asp"> <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Header.ascx.cs" Inherits="M2iSTS2.UserControl.Header" %> <link href="/Styles/styles.css" rel="stylesheet" type="text/css" /> <script language="javascript" type="text/javascript" src="../Script/Map.js"></script> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <input type="button" value="Button1" id="hdnBtn" runat="server" onserverclick="assignValue"/> <div id="header" class="header"> <h1 class="h1">TrackU: Student and Vehicle Tracking System</h1> <p class="p"><a class="a" href="/Account/login.aspx" önclick='setSession()'>Logout</a></p> </div> <div> <ul class="ul"> <li class="li"><a class="lia" href="/Admin/Fleet.aspx">Fleet</a></li> <li class="li"><a class="lia" href="/Admin/StudentInfo.aspx">Student Info</a></li> <li class="li"><a class="lia" href="/Admin/RouteSettings.aspx">Route Settings</a></li> <li class="li"><a class="lia" href="/Admin/Reports.aspx">Reports</a></li> </ul> </div> </pre> javscript function as below, <pre lang="javscript"> function setSession() { alert(document.getElementById('hdnBtn')); } </pre> but the <pre lang="cs">alert(document.getElementById('hdnBtn'));</pre> giving the 'null'.why? how to get the id of button in usercontrol? Thanks
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)