Wednesday, June 16, 2010

Edit button visible per row in DataGrid

This is an issue that we always need to do. However, sometimes we are not sure about where to do the coding and how.

The event:
Grid_ItemDatabound

How to - Example:

1 Protected Sub wgdLots_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles wgdLots.ItemDataBound
2 Dim txtQtyPlannedGrid As
Telerik.Web.UI.RadNumericTextBox
3 Dim txtQtyPickGrid As
TextBox
4 Try

5 If e.Item.ItemType = GridItemType.EditItem Then

6 txtQtyPlannedGrid = CType(e.Item.FindControl("txtQtyPlannedGrid"
), Telerik.Web.UI.RadNumericTextBox)
7 txtQtyPickGrid = CType(e.Item.FindControl("txtQtyPickGrid"
), TextBox)
8 If Not txtQtyPickGrid Is Nothing Then

9 strPallet = e.Item.Cells(1
).Text
10 If strPallet = "" Or strPallet = " " Then

11 txtQtyPickGrid.Enabled = False

12 End If

13 End If

14 Else

15 If CDbl(txtQtyPlanned.Text) = 0 Then

16 e.Item.Cells(12).Visible = False

17 End If

18 End If

19

20 Catch ex As Exception
21 Call ManageError(strGlobalUser, strAppName, strModName, "wgdLots_ItemDataBound"
, intGlobalMain, Err, strGlobalPathError, ApplicationType.Web)
22 End Try

23

24 End Sub

No comments:

Post a Comment