Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
165
How to add bands or group or row programatically
posted

I am trying to add a new definition to the ultragrid control at run time.

I am not using dataset. 

I want something like this

But I don’t know how to make it on code.

My code is:

 

Private Sub ShowOneEmpleado()

ToV = 0 : ToE = 0

SetGridVacUnoSolo()

With UltraGrid1

     tbCodigo.Text = lbCodigos.SelectedItem : CodigoEnUso = lbCodigos.SelectedItem

     'mostrar lo pagado de vac y de enf

     CalVacacionesUnSolo()

     'calcular cuanto tiene disponible Vac y Enf

     CalVacaciones() : If answer = 255 Then answer = 0 : GoTo 90

     c1 = Amt : Amt = 0 : If c1 > mi Then c1 = mi

     CalEnfermedad() : If answer = 255 Then answer = 0 : GoTo 90

     c2 = Amt : Amt = 0 : If c2 > mt Then c2 = mt

     'Totalizar

     Dim row As DataRow = dataTable.NewRow()

     row("Fecha Pago") = "Gran Total"

     row("Número Cheque") = ""

     row("Horas Vac") = THV

     row("Pago Vac") = FormatNumber(ToV, 2)

     row("Horas Enf") = THE

     row("Pago Enf") = FormatNumber(ToE, 2)

     dataTable.Rows.Add(row)

 

90:   ' bind DataTable to UltraWebGrid

     .DisplayLayout.Bands(0).Header.Caption = CodigoEnUso & "     Vac Disponibles: " & c1 & "    Enf Disponibles: " & c2

      UltraGrid1.DataSource = dataTable : UltraGrid1.DataBind() : tbCodigo.Enabled = True : ub5.Visible = True : ub11.Visible = True

100:  ub2.Visible = False : ub3.Visible = True : answer = 0

      tbCodigo.Enabled = False : lbCodigos.Visible = False

End With

End Sub

 

Private Sub SetGridVacUnoSolo()

Dim bnd As UltraGridBand = UltraGrid1.DisplayLayout.Bands(0)

With UltraGrid1.DisplayLayout

  With .Bands(0)

    .HeaderVisible = True

    .Header.Caption = "VACACIONES Y ENFERMEDAD"

    .Header.Appearance.BackColor = Color.CornflowerBlue

    .Header.Appearance.ForeColor = Color.White

    .Override.AllowUpdate = DefaultableBoolean.False

  End With

  .Override.CellClickAction = CellClickAction.RowSelect

  .Override.RowSelectors = DefaultableBoolean.False

  .Override.RowAppearance.BackColor = Color.WhiteSmoke

  .Override.RowAlternateAppearance.BackColor = Color.FromArgb(254, 228, 209)

  .Override.CellAppearance.TextHAlign = HAlign.Right

  .Override.CellAppearance.TextVAlign = VAlign.Middle

  .Override.SelectedRowAppearance.BackColor = Color.Beige

  .Override.SelectedRowAppearance.ForeColor = Color.Black

  .Override.DefaultRowHeight = 30

End With

  'formar la tabla

dataTable.Columns.Clear() : dataTable.Rows.Clear()

UltraGrid1.DataSource = dataTable : UltraGrid1.DataBind() : UltraGrid1.Layouts.Clear()

Dim col As New DataColumn

col = New DataColumn("Fecha Pago", GetType(String)) : dataTable.Columns.Add(col)

col = New DataColumn("Número Cheque", GetType(String)) : dataTable.Columns.Add(col)

col = New DataColumn("Horas Vac", GetType(String)) : dataTable.Columns.Add(col)

col = New DataColumn("Pago Vac", GetType(String)) : dataTable.Columns.Add(col)

col = New DataColumn("Horas Enf", GetType(String)) : dataTable.Columns.Add(col)

col = New DataColumn("Pago Enf", GetType(String)) : dataTable.Columns.Add(col)

col = Nothing

 UltraGrid1.DisplayLayout.PerformAutoResizeColumns(True, PerformAutoSizeType.AllRowsInBand)

 End sub

 

 -----------------------------------------------------------------------------------------------------------------------------------------------------------------

I want to show an information on top first line then add another band or group or child, whatever with the rest of the data.

 

Ariel Maisonet

 

Using 17.1

Parents Reply Children
No Data