Click here to Skip to main content
15,898,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am calling a js(example1.js). I want to assign that name dynamically as per the login empid.
Please help.



XML
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="True"
    Inherits="PM_Roots_RootChild" Title="Organisation Chart" CodeFile="RootChild.aspx.cs" %>

<%@ Register Src="../../UserControl/UCSearch.ascx" TagName="UCSearch" TagPrefix="uc1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
 <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder" runat="Server">

    <link type="text/css" href="../../Css/base.css" rel="stylesheet" />
    <link type="text/css" href="../../Css/Spacetree.css" rel="stylesheet" />
    <!--[if IE]><script language="javascript" type="text/javascript" src="../../Extras/excanvas.js"></script><![endif]-->
    <!-- JIT Library File -->
    <script language="javascript" type="text/javascript" src="../../JavaScripts/jit.js"></script>
     <script src="js/example1.js" type="text/javascript"></script>

      <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
            <table style="width: 100%">
                <tr>
                    <td>
                        Employee Name
                    </td>
                    <td class="style1">
                        <uc1:UCSearch ID="UCpeople" runat="server" Visible="true" TableName="EMPMASTER" Record_Size="8"
                            Aid_Field_Name="Employee Id" Desc_Field_Name="Name,Designation,department,Location"
                            Display_Field="Name" Enable="true" Mid_Field_Name="Employee Code" Filter_Values="Name,Designation,Department,Location,EmailID,Joining Date,PAN No"
                            __designer:wfdid="w2"></uc1:UCSearch>
                    </td>
                    <td>
Posted
Comments
Sergey Alexandrovich Kryukov 5-Mar-14 10:59am    
Assign name — to what?
—SA
Member 10628913 6-Mar-14 1:32am    
Sir see in d code ders a src =js/example1.js.Now in the frond end i am asking the user to enter his empid or emp name.Now depending upon the empid i want to rename the example1.js file to the name of the empid.eg if the id is 111 den the example1.js file should get replace by 111.js.thats wat i want to know sir.Thanks..

1 solution

Page.Header.Controls.Add(new LiteralControl(""));


In place of <b>FileName</b> add your FileName in codebehind according to your requirement.
 
Share this answer
 
Comments
Member 10628913 5-Mar-14 23:45pm    
Thanks alot..But my file name depends on the input text name.so should i give the text id in place of text..????
Member 10628913 5-Mar-14 23:50pm    
And i want to assign the name dynamically as per the required input in aspx file instead of cs file.Please Help..
nandakishoreroyal 6-Mar-14 1:00am    
Based on the text Assign Js file from your code..

EX:

if(txtName.text=="A)
{
FileName="YOUR FILE NAME";
}
else if(txtName.text=="B")
{
FileName="YOUR FILE NAME";
}
Member 10628913 6-Mar-14 1:21am    
Sir thats wat i want i want the file name dynamic as the text name.if the text name is C den it should create a c.js
Member 10628913 6-Mar-14 1:32am    
Sir see in d code ders a src =js/example1.js.Now in the frond end i am asking the user to enter his empid or emp name.Now depending upon the empid i want to rename the example1.js file to the name of the empid.eg if the id is 111 den the example1.js file should get replace by 111.js.thats wat i want to know sir.Thanks..

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