tailieunhanh - Professional ASP.NET 3.5 in C# and Visual Basic Part 39
Professional in C# and Visual Basic Part 39. Building on the revolutionary release, adds several key new developer features including AJAX, LINQ, and a new CSS designer in Visual Web Developer 2008. The dramatic reduction in code that developers realized from the more than 50 new server controls in now allows developers the time to make their applications more interactive with AJAX, to work with data in their preferred language with LINQ, and to build visually attractive and consistent standards-based sites with CSS. . | Chapter 7 Data Binding in your existing SqlDataSource control by adding an UpdateCommand attribute. This tells the data source control what SQL it should execute when it is requested to perform an update. Listing 7-35 shows the code to add the UpdateCommand attribute. Listing 7-35 Adding an UpdateCommand to a SqlDataSource control asp SqlDataSource ID SqlDataSource1 Runat server SelectCommand SELECT FROM Customers ConnectionString ConnectionStrings AppConnectionString1 DataSourceMode DataSet UpdateCommand UPDATE Customers SET CompanyName CompanyName ContactName ContactName ContactTitle ContactTitle Address Address City City Region Region PostalCode PostalCode Country Country Phone Phone Fax Fax WHERE CustomerlD original_CustomerID Notice that the UpdateCommand includes a number of placeholders such as CompanyName Country Region and CustomerlD. These are placeholders for the corresponding information that will come from the selected row in GridView. In order to use the parameters you must define them using the UpdateParameters element of the SqlDataSource control. The UpdateParameters element shown in Listing 7-36 works much like the SelectParameters element discussed earlier in the chapter. Listing 7-36 Adding UpdateParameters to the SqlDataSource control asp SqlDataSource ID SqlDataSource1 Runat server SelectCommand SELECT FROM Customers ConnectionString ConnectionStrings AppConnectionString1 DataSourceMode DataSet UpdateCommand UPDATE Customers SET CompanyName CompanyName ContactName ContactName ContactTitle ContactTitle Address Address City City Region Region PostalCode PostalCode Country Country Phone Phone Fax Fax WHERE CustomerlD original_CustomerID UpdateParameters asp Parameter Type String Name CompanyName asp Parameter asp Parameter Type String Name ContactName asp Parameter asp Parameter Type String Name ContactTitle asp Parameter asp Parameter Type String Name Address asp Parameter asp Parameter Type String Name City asp Parameter asp .
đang nạp các trang xem trước