Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 01, 2012 11:22 AM by kedarrkulkarni
Member
55 Points
64 Posts
Feb 27, 2012 09:35 AM|LINK
Dear All
Am adding a script file in my master page like below.
<script type="text/javascript" src="http://localhost/scripts/jquery.mvk.js"></script>
my intension is to put "http://localhost" or any thing other local server name is mention in web config file like below
<add key="Path" value="http://localhost"/>
So am getting this value in master page like below
<%String Path = System.Configuration.ConfigurationManager.AppSettings["Path"].ToString(); %>
How to concatenate the src in script tag
<script type="text/javascript" src= path+ "/scripts/jquery.mvk.js"></script>
Here am getting error writing like above, plz...... tel me the solution fot this.
In Advance Thanks to all....
710 Points
129 Posts
Feb 27, 2012 09:51 AM|LINK
Add a hidden field in page and On PageLoad store the value from configuration to this hiddenfield. in javascript get the value from hiddenfield to javascript variable and try.
All-Star
42885 Points
7019 Posts
MVP
Feb 27, 2012 09:57 AM|LINK
Vinod Bheemisetty Am adding a script file in my master page like below. <script type="text/javascript" src="http://localhost/scripts/jquery.mvk.js"></script> my intension is to put "http://localhost" or any thing other local server name is mention in web config file like below <add key="Path" value="http://localhost"/> So am getting this value in master page like below <%String Path = System.Configuration.ConfigurationManager.AppSettings["Path"].ToString(); %> How to concatenate the src in script tag <script type="text/javascript" src= path+ "/scripts/jquery.mvk.js"></script> Here am getting error writing like above, plz...... tel me the solution fot this.
Why don't you give the relative path? Like
<script type="text/javascript" src= "../scripts/jquery.mvk.js"></script>
Please 'Mark as Answer' if this post helps you.
16006 Points
1728 Posts
Microsoft
Feb 29, 2012 07:30 AM|LINK
Try this:
public string Path = string.Empty; protected void Page_Load(object sender, EventArgs e) { Path = System.Configuration.ConfigurationManager.AppSettings["Path"].ToString(); }
<script type="text/javascript" src= '<%=Path+ "/scripts/jquery.mvk.js"%>'></script>
Mar 01, 2012 10:45 AM|LINK
Thank you very much Frank Jiang....
But, i tred with same code what you said but getting error please do have any other better Idea let me know....
34013 Points
5468 Posts
Mar 01, 2012 11:22 AM|LINK
can you use another approach...
protected void Page_Load(object sender, EventArgs e) { string strPath = System.Configuration.ConfigurationManager.AppSettings["Path"].ToString(); Page.ClientScript.RegisterClientScriptInclude(this.Page, strPath); }
hope this helps...
Vinod Bheemi...
Member
55 Points
64 Posts
How to concatenate src in java script tag
Feb 27, 2012 09:35 AM|LINK
Dear All
Am adding a script file in my master page like below.
<script type="text/javascript" src="http://localhost/scripts/jquery.mvk.js"></script>
my intension is to put "http://localhost" or any thing other local server name is mention in web config file like below
<add key="Path" value="http://localhost"/>
So am getting this value in master page like below
<%String Path = System.Configuration.ConfigurationManager.AppSettings["Path"].ToString(); %>
How to concatenate the src in script tag
<script type="text/javascript" src= path+ "/scripts/jquery.mvk.js"></script>
Here am getting error writing like above, plz...... tel me the solution fot this.
In Advance Thanks to all....
<div></div>
Vinod Bheemisetty
Usha82
Member
710 Points
129 Posts
Re: How to concatenate src in java script tag
Feb 27, 2012 09:51 AM|LINK
Add a hidden field in page and On PageLoad store the value from configuration to this hiddenfield. in javascript get the value from hiddenfield to javascript variable and try.
Ruchira
All-Star
42885 Points
7019 Posts
MVP
Re: How to concatenate src in java script tag
Feb 27, 2012 09:57 AM|LINK
Why don't you give the relative path? Like
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.Frank Jiang ...
All-Star
16006 Points
1728 Posts
Microsoft
Re: How to concatenate src in java script tag
Feb 29, 2012 07:30 AM|LINK
Try this:
public string Path = string.Empty; protected void Page_Load(object sender, EventArgs e) { Path = System.Configuration.ConfigurationManager.AppSettings["Path"].ToString(); }Feedback to us
Develop and promote your apps in Windows Store
Vinod Bheemi...
Member
55 Points
64 Posts
Re: How to concatenate src in java script tag
Mar 01, 2012 10:45 AM|LINK
Thank you very much Frank Jiang....
But, i tred with same code what you said but getting error please do have any other better Idea let me know....
Vinod Bheemisetty
kedarrkulkar...
All-Star
34013 Points
5468 Posts
Re: How to concatenate src in java script tag
Mar 01, 2012 11:22 AM|LINK
can you use another approach...
protected void Page_Load(object sender, EventArgs e) { string strPath = System.Configuration.ConfigurationManager.AppSettings["Path"].ToString(); Page.ClientScript.RegisterClientScriptInclude(this.Page, strPath); }hope this helps...
KK
Please mark as Answer if post helps in resolving your issue
My Site