How to inspect an element in c# like firebug does?
Is there a way to inspect/spy elements in a web browser like firebug does when we move the mouse over the webpage? How to to it in c#??
EDIT:
Actually I just want to get the HTML source code from the t开发者_开发百科agged element.
Best regards.
Asp.Net framework uses "HTMLTextWriter" class to generate the HTMl markup for server controls.If say for example , you want the HTML markup for gridview control , then you can make use of this class and its associated member functions to get the markup.But again its all a part of server side logic and achieving the same through client side code is not that easy.If you can provide more information on whats the exact requirement then it will be quiet nice.
You cannot interrogate dynamically the client side rendering of a server side control via the browser. There is a disconnect between the server and client side that it maintained through the .Net viewstate model. You can generally tell which DOM elements have been generated via server side code through the ID having an extended value but this is not any guarantee etc. In .Net 4.0 the client side IDs will be able to be set via the server side so even this is tenuous.
As James has said, you should use firebug to determine the output on the client side and then tailor your server side rendering accordingly.
Can you provide a more detailed example of what you are trying to achieve and perhaps there is a further solution / explanation that can be offered?
精彩评论