ASP.NET GridView – OnRowDataBound vs OnRowCreated

This morning, while I was creating a simple ASP.NET page, I have fought a couple of hours versus a GridView that apparently worked in strange ways.

Problem Description

The problem I encountered seemed to be the wrong setting of the property “ID” of the Client-side controls. Generally, the ASP.NET engine (prior to version 4.0) takes fully charged to change the ID to avoid duplication, so that they are always unique. Particularly in the case of a GridView fact, for a control that we insert with ID = “txtSelectedValue”, and that is repeated for each row of the grid, will have a ClientID like this:

Continue reading

Advertisements

ASP.NET Underground tour (Part 1)

To fully understand how to use ASP.NET is necessary to know the basic operation of the web (for example as occurs a request from browser to server, what are the technologies used, how a web server processes the request, etc. …).

Understanding why a web page is not interpreted correctly in a browser, because a request is not performed as expected, or generate the appropriate HTML code from a custom control, are questions that do not depend only on knowledge of ASP.NET (or any other technology), but also from the knowledge of how a web application works.

Continue reading