Hi,
From the code, we can see the path of referencing the js file is
mohamed hassan: strScript = ".\\menu.js";
, it is not seemly a correct format for the file path.
You can try to check this thread: http://forums.asp.net/t/1023605.aspx
Or try to use the below code.
protected void Page_Load(object sender, EventArgs e)
{
// Define the name, type and url of the client script on the page.
String strname = "ButtonClickScript";
String strurl = "~/JScript.js";
Type cstype = this.GetType();
// Get a ClientScriptManager reference from the Page class.
ClientScriptManager csm = Page.ClientScript;
// Check to see if the include script exists already.
if (!csm.IsClientScriptIncludeRegistered(cstype, strname))
{
csm.RegisterClientScriptInclude(cstype, strname, ResolveClientUrl(strurl));
}
//for the body onload functionality
string temp = "ShowMenu()";
HtmlGenericControl body = (HtmlGenericControl)Master.FindControl("Body");
body.Attributes.Add("onload", temp);
}
About the ClientScriptManager.RegisterClientScriptInclude Method, you can check this MSDN article: http://msdn2.microsoft.com/en-us/library/kx145dw2.aspx
Hope it helps.
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Yours sincerely,
Amanda Wang
Microsoft Online Community Support