Monday, September 26, 2011

1.x DataGrid, 2.0 GridView, Declarative Syntax in HTML portion...

"In Microsoft ASP.NET 1.x, one of the most commonly used ASP.NET Web controls is the DataGrid. The DataGrid control makes displaying data on an ASP.NET page a breeze: simply drag and drop the DataGrid onto your ASP.NET page, specify the columns and formatting, and write just a few lines of source code to retrieve and bind the data to the DataGrid. With a bit more effort and code, you could enable the end user to page, sort, and even edit the data within the DataGrid.


While the DataGrid was a huge improvement over pre-ASP.NET techniques for displaying data, it still suffered some limitations. For starters, binding any data to a DataGrid required some code writing, and often repetitive code at that. Furthermore, utilizing any of the DataGrid's more advanced features—handling deletes, allowing for editing of the underlying data, providing pagination, or sorting support—required additional code and time. Granted, the code for many of these additions was not terribly complex or lengthy, but any time code is written the possibility of new bugs, typos, or errors is introduced.

ASP.NET 2.0 fixes the problems of the DataGrid through a set of data source controls designed to encapsulate data that can be bound to data Web controls, and a replacement for the DataGrid—the GridView control. To access data in ASP.NET 1.x, developers had to write code; with the data source controls, however, data can be accessed through declarative syntax in the HTML portion of the ASP.NET Web page. Like other ASP.NET controls, the data source controls can be added to a page by simply dragging and dropping them from the Microsoft Visual Studio Toolbox onto the ASP.NET page Design view. Additionally, the specific data to retrieve can be specified entirely through the Design view. Once a data source control has been configured, it can be bound to a data Web control, such as the GridView, by setting the data Web control's DataSourceID property to the ID of the data source control. That's all there is to it—no code necessary!"

http://msdn.microsoft.com/en-us/library/aa479340.aspx

Tuesday, September 20, 2011

Basic IFrame Use with JavaScript

Here is the simplest example:

<html>
<body>
<iframe id="smedly" src="http://www.google.com"></iframe>
<input type="button" onclick="dothis();" value="Yahoo">
<script>
function dothis(){
document.getElementById('smedly').setAttribute('src','http://www.yahoo.com');
}
</script>
</body>
</html>