Replace text in asp.net page vb

  • Thread starter TheVillageCodingIdiot
  • Start date
T

TheVillageCodingIdiot

I have a ASP.net page that is a template letter and have some place
holders for variables i want to put in. For instance

<div runat="server" id="Page1">
Dear [EmployeeName],
'Letter text below
</div>

Now "[EmployeeName]" is scattered throughout the page wherever we need
to put there name. Is there a way to go through and replace all
"[EmployeeName]" with like "John Doe" when they are not in any
controlls other then the DIV?
 
S

Scott M.

Really, what you should be doing is using ASP .NET label controls for this.
The way you are doing this now, you are missing the whole point/power of
server-side controls. The use of DIV's is really irrelevant. The following
code would allow you to dynamically populate lblTo via server-side logic
with any value you require.



<form runat="server" id="Form1">

Dear <asp:Label id="lblTo" runat="server">,

'Letter text below

</form>



Wherever else you need the name, just make more labels and populate them in
your server-side code.



-Scott









I have a ASP.net page that is a template letter and have some place
holders for variables i want to put in. For instance

<div runat="server" id="Page1">
Dear [EmployeeName],
'Letter text below

Now "[EmployeeName]" is scattered throughout the page wherever we need
to put there name. Is there a way to go through and replace all
"[EmployeeName]" with like "John Doe" when they are not in any
controlls other then the DIV?





TheVillageCodingIdiot said:
I have a ASP.net page that is a template letter and have some place
holders for variables i want to put in. For instance

<div runat="server" id="Page1">
Dear [EmployeeName],
'Letter text below
</div>

Now "[EmployeeName]" is scattered throughout the page wherever we need
to put there name. Is there a way to go through and replace all
"[EmployeeName]" with like "John Doe" when they are not in any
controlls other then the DIV?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top