views:

49

answers:

2

Hello friends,

I am having an aspx page with a user control in it. The usercontrol contains the GridView. At some place within this usercontrol i need html code of GridView.

Can anybody provide help on how i can get html code of GridView.

Thanks for sharing your time.

+1  A: 

The best source is to put a gridview into an aspx page and render it on the browser. On the browser, you can just right-click and View the source. You can copy paste and change accordingly.

Kangkan
Thanks buddy! But its somewhat complicated situation. Actually I have a GridView (gvStocks) having list of stock#. I am using devArchieve ToolTip control to show tooltip on each stock when mouse is hover. I need the tooltip to show notes associated with each stock. So I took another gridview (gvTemp) which is dynamically bounded depending upon stock#. I am trying to get the html source of this grid to provide it within the tool tip control. Thats why i need the html code.
IrfanRaza
I am trying with this code - System.IO.StringWriter oStringWriter = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter); gvTemp.RenderControl(oHtmlTextWriter); but it gives me an error indicating it needs a form.
IrfanRaza
+1  A: 

What do you mean html code? I'm assuming you don't want to view the HTML code via your browser --> View Source (or alternatively click on the control and view source), but do some sort of extraction/editing in HTML via your code in C#? Is that correct? If so you might be able to use JQuery - but it dpeends on your requirements.

EDIT: You can also try Firebug for Firefox since that can show you client side as code that's coming in from JavaScript, CSS, etc.

firedrawndagger
Thank you my friend. But please read my comment to the next answer.
IrfanRaza