Rendering and Viewing Source in ASP.NET
-
I am trying to create an ASP.NET app using C# in VS 2005. I have a number of fixed Panels in the HTML, that I dynamically populate with server controls as the user utilizes the application. I have noticed that as I populate some of the panels dynamically, the controls render okay. But I do View Source in Internet Explorer and the generate HTML markup for the dynamically-generated controls is no where to be found in the source. However, they are there, rendered on the page. Does that make sense? Shouldn't I always be able to see the generated HTML from ASP.NET? Thanks, Mark
-
I am trying to create an ASP.NET app using C# in VS 2005. I have a number of fixed Panels in the HTML, that I dynamically populate with server controls as the user utilizes the application. I have noticed that as I populate some of the panels dynamically, the controls render okay. But I do View Source in Internet Explorer and the generate HTML markup for the dynamically-generated controls is no where to be found in the source. However, they are there, rendered on the page. Does that make sense? Shouldn't I always be able to see the generated HTML from ASP.NET? Thanks, Mark
If you are using normal html controls like div, input etc, it will be directly rendered as you made. The id of those controls might change sometimes. On the other hand asp.net controls renders differently. The asp.net controls renders normal html with some javascript and css etc to handle them. For instance : If you write
<asp:label>
it will render it as<span>
This is because browser knows nothing other than HTML. So to work in Browsers the server side Handlers should render proper html. Moreover if you are using Masterpage, the Id of each control will be placed in such a way that its name contains the ContentPlaceholder name. This is just to ensure that there is no ambiguity betweenMasterpage
controls and Content page controls. You can get the id generated for each control in the server side by calling its ClientId. Try to look carefully on your code.. .I think you will find them hidden somewhere. :rose::rose:Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.