DevExpress ASPxGridView
In this example, the GridView has 4 columns, a column with a checkbox, and 3 columns of data. I want to loop \ through all grid columns and get which checkboxes are selected. (Note the same column with the checkbox also \ has a hiddel ASPxLabel called lblID that holds the OPC_ID of the database row to be deleted). And in the \ GetCurrentPageRowValues("Confirm"), confirm is the header name (not caption, but name=) of a column in the grid (column display \ headers are 'Confirm,Op Code,Oldest History, RO Count')
Protected Sub btnConfirm_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnConfirm.Click Dim i As Int16 = 0 Dim chk As DevExpress.Web.ASPxEditors.ASPxCheckBox Dim lblID As DevExpress.Web.ASPxEditors.ASPxLabel For i = 0 To grdConfirm.GetCurrentPageRowValues("Confirm").Count - 1 chk = grdConfirm.FindRowCellTemplateControl(i, grdConfirm.Columns(0), "chkDelete") If chk.Checked Then lblID = grdConfirm.FindRowCellTemplateControl(i, grdConfirm.Columns(0), "lblID") 'lblError.Text &= lblID.Text.ToString & "," DAL.OpcHistory.DelSelection(Val(ddlCategory.Value.ToString), Me.DLR_ID, lblID.Text) End If Next pnlConfirm.Visible = False pnlOptions.Visible = True txtFilter.Text = "" Me.FillListBoxes() End Sub
I have 2 grids, one is inside the others edit template, I want to hide the second grid with a client side click.
Note, the ASPxRadioButton, or all ASPx controls don't have a standard onclick, so I surrounded it with a div
This is just a nice example of finding the element id of a burried grid with javascript somecode.aspx
... ').style.display='none';"> ... ...
This is a beauty, when they click edit on the master grid, I want the second grid to be clientside display:none or block \ depending on a value in the master grids database column.
So if the database column value is > 0 then I should display the second grid. So I wrote a codebehind vb function
Public Function test(ByVal value As Integer) As String If value > 0 Then Return "block" Else Return "none" End Function
Then in the .aspx page, I set a variable style parameter
Select the Custom Page Permission for this group ...
So the Eval("Limit") sets the radLimit radio button above, so it radLimit is checked (So Eval(Limit) > 0) then \ show the grid initially, else hide it. Nice!
You can even skip the codebehind function creation and simply use the build in function IIF, this is a better solution.