Rowupdating vs rowediting consciousdatingseminars com

NET一個很大的優勢,以下針對Grid View事件做一個整理,而且每一個事件裡都把常用參數整理好,再加上一個小小範例,以後有Grid View方面事件的問題,就可以直接查這篇,可以當成Grid View事件快速入門篇。 Protected Sub Grid View1_Row Created(By Val sender As Object, By Val e As System.

Row Type:在執行作業之前判斷資料列的型別。 '範例: Sub Protected Sub Grid View1_Row Command(By Val sender As Object, By Val e As System.

And here I’m explaining some basic functions of this gridview control such as insert edit and delete a record.

First, we need to prepare the database table and stored procedure for gridview operations such as insert, update & delete a records, here I’m using sql server 2008 for all database activities, for this sample I have created the customer table and stored procedure for all mentioned gridview operations.

In order to implement paging you need to set Allow Paging property of the Grid View control to True. There are two events of Grid View that are related to paging.

They are: The former event is raised before the current page changes and the later is raised after the page has changed. Write the following code in the Page Index Changing event of the Grid View.

Among them, you can find fields that enable/disable insertion and removing, as well as editing itself. In order to enable them, add the following code to the grid's configuration object.

This calls for some extra coding from developer's end. As an example we are going to use Employees table of the Northwind database. Add three Bound Fields and a Command Field to the Grid View with the help of Fields dialog (see below).

Separator:Grid View 控制項中的分隔列。 '如果資料的類型是「資料列Data Row」,第一個儲存格文字改為粗體。 If e.

Text & "" End If End Sub Protected Sub Grid View1_Row Deleting(By Val sender As Object, By Val e As System.

Grid View實在是非常好入門的控制項,讓我們可以知一解百,也就是說,你如果能完全了解Grid View控制項,那其他類似的資料處理控制項你也差不多學完了,所以對Grid View的投資是非常值得。 除了要好好了解拉放之間滑鼠及Vistual Studio帶來的便利,我覺的學好Grid View 事件,對學習ASP.

NET有更重大的意義,一般控制項了不起就是Page_Load、Click、Change、Select這幾類,但Grid View不同,因為它能幫你做好多好多事,所以他的事件就複雜很多,複雜不代表難。 Grid View的事件多數都有前後之分(ing或ed結尾),這樣的事件流程讓我們可以對整個控制項或資料處理上有更靈活的操作,例如我要進行刪除作業: 刪除前 → 刪除中 → 刪除後 除了刪除中是我們無法操作的(因為刪除動作是在資料庫),我們可以在刪除前先做個Double Check,刪除後再Check一次及提示訊息。這是以前ASP所做不到的。「事件」可以說是ASP.

Leave a Reply