TAILIEUCHUNG - Hyperlink from a Row in the Data Grid to a Detail Page

Làm thế nào để hiển thị thông tin chi tiết trong một trang riêng biệt từ một điều khiển DataGrid? Kỹ thuật Một trong những loại cột mà bạn có thể sử dụng trong lưới dữ liệu là cột HyperLink. | Hyperlink from a Row in the Data Grid to a Detail Page Often I need to zero in and display data based on a record in the DataGrid control. How do I display detail information in a separate page from a DataGrid control Technique One of the types of columns that you can use in the data grid is the HyperLink column. This column makes it fairly easy to link pages based on data. To see how the HyperLink type column is used in this How-To take a look at Figure . Figure . No code is required for link pages based on data. By your specifying the URL Field to be ProductID and URL Format String to be ID 0 the data grid automatically calls the and passes the ProductID to the form when you click on a product. Steps Open and run the Visual Basic .NET-Chapter 5 solution. From the main page click on the hyperlink with the caption How-To Hyperlink From a Row in the Data Grid to a Detail Page. You then see all the products loaded into a data grid. Notice that the products are actually hyperlinks see Figure . Figure . These hyperlinks require no code to call a detail page. When you click on a product another page is displayed with detail information supplied see Figure . 1. Create a Web Form. Then place the controls in Table and Figure with the following properties set. Table . Property Settings for the Controls Used on the First Page of This How-To Object Property Setting OleDbDataAdapter ID odaProducts SelectCommand SELECT ProductID ProductName FROM Products DataSet ID dsProducts DataGrid ID dgProducts DataSource dsProducts DataKeyField ProductID DataMember Products HyperLink ID hplReturnToMain NavigateURL 2. Right-click on the DataGrid control and choose Property Builder. Click on the Columns tab and set the properties as displayed in Figure . Be sure to note the name of the form you are calling in the URL Format String so that you can name it the same in step 4. 3. Add the code in

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.