Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8127757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:38:40+00:00 2026-06-06T07:38:40+00:00

I want to change some string located in html file when it loads. For

  • 0

I want to change some string located in html file when it loads. For example, i have a html file:

<html>
<head>
<title>MyTitle</title></head>
<body>
Some Text
<script type='text/javascript'>
/*some script*/
var myString = "TargerInfo";
/*some script*/
</script>
</body>
</html>

I use Page_Load method in code-behind file:

protected void Page_Load(object sender, EventArgs e)
{
/*Insert necessary snippet of code*/
}

What code should i use to change string “TargerInfo” to “OtherString” ?

[EDIT]
Sorry, that I have forgot to mention
I can add any info to html page only in code-behind class, because this page isn’t generated by me.
I think i should use something like this:

1) load html file

2) find my string

3) replace it

4) send html file

There is an aspx page, but i add only some part of code and other code is added by VS

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T07:38:42+00:00Added an answer on June 6, 2026 at 7:38 am

    Unless I’m missing something (because this seems like a bit of an ASP.NET 101), you have several options…

    Create a variable in the code-behind and then use that…

    protected string _newText = "";
    protected void Page_Load(object sender, EventArgs e)
    {
       _newText = "OtherString";
    }
    

    And then in the ASPX…

    var myString = "<%=_newText%>";
    

    Otherwise you can use the <asp:Literal> control

    UPDATE

    After an extensive chat with @andDaviD it turns out that the javascript is in a Master page held in SharePoint Foundation.

    The Master page is being referenced in his Content page via the DynamicMasterPageFile attribute in the <%@ Page directive, and that is why he said he is able to update some part of the code, but not others.

    I am still unsure as to whether it is possible for the Master page to be modified (either by himself or an administrator), that is something he needs to find out from the people in charge at his company. But I believe the adding of a property or method to the Master Page to provide what he needs is the only sensible option.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Simple example: we have string Some sample string Of Text. And I want to
I have a big txt file ,with many strings ,say string-I-want-to-change,now I need to
I have a treeView with many nodes. I want that some nodes change their
I'm doing some kind of own templates system. I want to change <title>{site('title')}</title> Into
I have some variables I want to change via GUI. The variables are of
I have doInBackground() . after function I want to change some TextView on MainActivity
I have an html file that I want to dynamically edit before displaying to
I have some part numbers as a string.For example : partnumber = a1;a2;a3 Now
I want to change some properties of a LINQ query result object without creating
I want to change master page some label value from child page.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.