?
Solved

How to retrieve content of a DataGrid control?

Posted on 2004-04-10
3
Medium Priority
?
199 Views
Last Modified: 2010-04-15
I have a DataGrid control that I is formated and displayed as a table in HTML.
How do I retrieve the formatted html (i.e. end result of displaying DataGrid) from the DataGrid control?

More specifically, I am using the DataGrid in a UserControl - thus, is there a way of retrieving the formatted output of the DataGrid.

Cheers.
0
Comment
Question by:smacca
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:smacca
ID: 10799869
THOUGHTS OUT ALOUD:

  * Perhaps I could place within a container that has a Text property?? Does the Panel control do this or any other?
 
0
 

Author Comment

by:smacca
ID: 10800210
SOLUTION:
----------------


public string GetContent()
{
      //get the rendered HTML
      StringBuilder sb = new StringBuilder();  
      StringWriter sw = new StringWriter(sb);
      HtmlTextWriter htw = new HtmlTextWriter(sw);
      dgRecordDataGrid.RenderControl(htw);                
      return Server.HtmlEncode(sb.ToString());
}
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 10801674
Closed, 400 points refunded.
modulo
Community Support Moderator
Experts Exchange
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question