3

Hi i have values in c# and i want to transfer this value to Html page by using parameter. here what i did

C#:::

protected void btnPreviewEmail_Click(object sender, EventArgs e)
{
    string body = string.Empty;
    using (StreamReader reader = new StreamReader(Server.MapPath("~/EmailTemplate/ExportJobsEmailTemplate.html")))
    {
        body = reader.ReadToEnd();
    }
    body = body.Replace("{jobnumber}", txtJobNo.Text);
}

HTML Page ::::

<table>
    <tr>
        <td>
            <b>Job Number</b>
        </td>
        <td>{jobnumber}</td>
    </tr>
</table>
4

1 Answer 1

6

You can do this by.

First initialize your server side variable as public

 public string YourText;

Then in your code

YourText = body.Replace("{jobnumber}", txtJobNo.Text);

and finally in HTML put

<table>
<tr>
    <td>
        <b>Job Number</b>
    </td>
    <td>'<%=YourText%>'</td>
</tr>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.