TAILIEUCHUNG - ASP.NET 4 Unleased - p 170

Building Templated Databound Controls LISTING void Page_Load() { if (!) { = “Laptop”; = ; (); } } protected void ProductForm1_ProductUpdated(object sender, EventArgs e) { = [“Name”].ToString(); = [“Price”].ToString(); } Show ProductForm | 1664 CHAPTER 37 Building Templated Databound Controls LISTING @ Page Language C @ Register TagPrefix custom Namespace myControls DOCTYPE html PUBLIC - W3C DTD XHTML Transitional EN http TR xhtml1 DTD script runat server void Page_Load if Laptop protected void ProductForm1_ProductUpdated object sender EventArgs e Name .ToString Price .ToString script html xmlns http 1999 xhtml head id Head1 runat server title Show ProductForm title head body form id form1 runat server div custom ProductForm id ProductForm1 Runat server OnProductUpdated ProductForm1_ProductUpdated EditItemTemplate asp Label id lblName Text Product Name AssociatedControlID txtName Runat server asp TextBox id txtName From the Library of Wow eBook Creating Templated Controls 1665 Text Bind Name Runat server br br asp Label id lblPrice Text Product Price AssociatedControlID txtPrice Runat server asp TextBox id txtPrice Text Bind Price Runat server br br asp Button id btnUpdate Text Update Runat server EditItemTemplate custom ProductForm hr New Product Name asp Label id lblName Runat server br br New Product Price asp Label id lblPrice Runat server div form body html In the Page_Load method in Listing the ProductForm Name and Price properties are set. Next the DataBind is called to cause the ProductForm control to evaluate its databinding expressions. The ProductForm control s EditItemTemplate includes Bind expressions instead of Eval expressions. You use Bind expressions in a two-way databinding template. From the Library of Wow eBook 1666 CHAPTER 37 Building Templated Databound Controls The EditItemTemplate includes a Button control. When you click the Button control the ProductForm control s OnBubbleEvent method executes the values are retrieved from the EditItemTemplate .

TÀI LIỆU MỚI ĐĂNG
21    24    0    10-08-2020
5    4    0    10-08-2020
20    3    0    10-08-2020
16    3    0    10-08-2020