Solved

How to retrieve content of a DataGrid control?

Posted on 2004-04-10
3
191 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
  • 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now