Click here to Skip to main content
11,934,783 members (39,750 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


3 bookmarked

Use of comment when retrieving a specific HTML content part of your compile aspx page

, 22 Dec 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
How to take screenshot of a particular part of Asp.Net page save it into the database
I have one requirement when developing a module.

I need to retrive HTML content of Budget part from the whole rendered HTML Page and save it in to database. This HTML content needs to displayed in a pop up window on the click of Details link of another page.

Firstly, I think by adding this Budget part into panel or div tag and then finding the budget part by the id of div/panel control be helful. However this Budget part also had div and panel cotrols inside it. So it is very difficult to get the indexOf ending div tag.

I got a very good solution for this. If you add <!-- Start Budget part --> and <!-- End Budget Part --> in your aspx code, you can get these comments in the compile page HTML code. Another comment like <%-- Start Budget part --%> <%-- End Budget part --%> will not occur in the compile page HTML.


int startind = strResult.IndexOf("<!-- Start Budget part -->");
strResult = strResult.Substring(startind);
int endind = strResult.IndexOf("<!-- End Budget part -->");
strResult = strResult.Substring(0, endind);

And thus I only need to find the indexof <!-- Start Budget part --> and <!-- End Budget Part --> and made a substring to retrieve the content.


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


About the Author

Sandesh M Patil
Software Developer (Senior)
India India
Sandesh has a 6 years of total professional experience in a software development. He first handled the computer in his school days when he was in 7th std working on Lotus. In summer vacation, the school authorities allowed him and other students to use the computers for practicing Lotus and playing different games Smile | :) .

He has done computer engineering. Currently he is working in Net 4.0 framework. Even though he is using .Net 4.0 framework for development but still he has not got a chance to work with newer technologies like MVC, WCF etc. However he always try to learn these technologies from his end and eagerly waiting for a chance to work with the newer technologies like MVC, WCF and Silverlight etc.

You may also be interested in...

Comments and Discussions

GeneralMy vote of 2 Pin
Sarvesh Kushwaha1-Sep-13 22:29
memberSarvesh Kushwaha1-Sep-13 22:29 
GeneralReason for my vote of 3 Try a innerHtml from JavaScript...It... Pin
maq_rohit22-Dec-10 20:12
membermaq_rohit22-Dec-10 20:12 
GeneralPlease provide the alternate if you have. I am storing this ... Pin
SChristmas6-Dec-10 5:07
memberSChristmas6-Dec-10 5:07 
Please provide the alternate if you have. I am storing this part in to database and retrieving the HTML content and displaying it in a pop up window on the click of a link of another page.
GeneralReason for my vote of 2 There are better techniques that foc... Pin
Dennis.D.Allen6-Dec-10 5:04
memberDennis.D.Allen6-Dec-10 5:04 
GeneralBetter solution will be using the JavaScript. I don't think ... Pin
Kunal_Chowdhury3-Dec-10 0:56
mvpKunal_Chowdhury3-Dec-10 0:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.151126.1 | Last Updated 22 Dec 2010
Article Copyright 2010 by Sandesh M Patil
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid