Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace words

Status
Not open for further replies.

berkshirea

Technical User
Mar 22, 2009
97
GB
hi guys,

suppose i have a database table:
id name link
1 tokyo 2 bangkok htt://3
.
.
.
and when i write on the page the contents of another database table, i want to replace on the fly every intance of the words tokyo, bangkok etc with the code <a href=" .... <a href=" ... etc

do you have any idea how to do that?

thanks for any info.
 
get the data, populate the model, render the view... am I missing something?
Code:
class MyController
{
   public ActionResult Index()
   {
        var cities = database.GetCities();
        return new View(cities);
   }
}
Code:
<%foreach(var city in Model.Cities) {%>
   <a href="<%=city.Url%>"><%=city.Name%></a>
<%}%>
this is MVC 101. there lots of examples on the web to aid in your learning.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top