Click here to Skip to main content
15,912,504 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi frnds...
Am working with the CMS sites Cms as made by using XML each page is taking content from the XML...in Aspx page i have give id for the paragraph as p1,p2.....etc...
for example...
C#
<div class="scroll">
<p id="p2" runat="server"></p></div>
this tag access the data from the xml for the paragraph...what is the think i need here how can i search and highlight this xml datas in the aspx with the search option...any one please help me...

Thanks in advance..
Prem Kumar.A
Posted
Updated 18-Jan-12 21:22pm
v2

1 solution

* how do you pull data from xml to your tags?
* why you need to highlight xml data?

Correct me if i am wrong: but what you are trying to do is like ie-8 when you click ctrl + f and type a key word "hello" and it will automatically highlight all matching word found in your page? isn't it browser specific?

Otherwise if you have own search button if you click search button and reload your aspx page since your page depends on the data from your xml i think before writing it down you can enclosed it with span tag and add background color.
 
Share this answer
 
Comments
premkannan2 19-Jan-12 3:56am    
i have my own search button in my page...if i click the search button it should find and highlight all the related text....please help me...am facing a problem in doing that...
premkannan2 19-Jan-12 4:01am    
i will show the example code...

this is the xml code


<img>images/about-img.jpg</img>
<txt>About Us
<t>
At Marshall Panelbeaters, we specialise only in the high quality restoration of classic and muscle cars, along with smash repairs. Metal shaping and custom panel fabrication is what we do. Our body shop is equipped with all of the machinery and tools necessary to speed up the restoration process for our clients and produce that quality finish you are looking for.<br>

The business has always been committed to producing the highest quality work possible and Rowan and his talented team have completed quality smash repairs for all major Insurance companies and have a quality record any business would be proud of.<br>
The constant pressure to keep up with all of the latest repair procedures has seen Marshall Panelbeaters invest in the latest welding technology. From pulse Tig welding to the latest Inverter Mig welding and Mig brazing imperative for welding high strength and Boron steels used on today's automobiles. However, Rowan was not happy unless he could duplicate the exact factory weld seen on today's cars. Non-factory welding is a dead give away that a vehicle has been involved in a collision, plus the fact that the new steels used on today's vehicles can not be welded with old welding technology. This event saw the business invest in the latest GYS inverter spot welder, capable of welding multi layers of steels from mild to ultra high strength and boron steels achieving the exact strength and appearance of the factory weld.<br>

Learning the trade when cars where made of real steel, Rowan decided to steer the business more into restoration. This saw the investment in some major fabrication equipment and it’s Rowan's infatuation for this type of machinery that is proving hard to shake and will no doubt continue to provide a superior and faster result for his clients<br>


Full photographic records are supplied with all jobs so that you can catch every moment of your projects progress, what ever its size. For your piece of mind, in the event we find something unforeseen on your vehicle, no work will be undertaken without prior approval from you. We encourage constant contact with the owners of vehicles. <br>

If you are involved in an accident or have a dream of restoring a classic or muscle car, give Rowan a call at Marshall Panel beaters. Our contact details are in the contact section of our website




in this code i have been specified page id as p2....

using this p2...we will load the xml file to the aspx page..using c# code..
Here the C# Code to load xml file...

int start = 0;
int indexOfSearchText = 0;
protected void Page_Load(object sender, EventArgs e)
{
int txt = 1, img = 1, a = 1, l = 1, g = 1;
string tempId;
try
{

XmlDocument xdoc = new XmlDocument();
xdoc.Load(Server.MapPath("xml/sample.xml"));
XmlNodeList NodeList = xdoc.SelectNodes("root/*");
foreach (XmlNode Node in NodeList)
{
if (Node.Attributes[0].InnerText.ToLower().Equals("p2"))
{
XmlNodeList Nodelist2 = Node.ChildNodes;
//foreach (XmlNode Node1 in Nodelist2)
//{
for (int i = 0; i <= Node.ChildNodes.Count; i++)
{
XmlNode Node1 = Node.ChildNodes[i];

if (Node1.Name.Contains("txt"))
{

tempId = "p" + txt;
HtmlGenericControl txtc = (HtmlGenericControl)form1.FindControl(tempId);
txtc.InnerHtml = Node1.InnerText;
txt++;

}
else if (Node1.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900