GrapeCity Forums

The GrapeCity Message Boards
Welcome to GrapeCity Forums Sign in | Join | Help
in Search

problem with appearance with rowheaders when click (+)

Last post 07-02-2009, 1:35 PM by SureshD. 12 replies.
Sort Posts: Previous Next
  •  06-29-2009, 5:05 AM 79581

    problem with appearance with rowheaders when click (+)

    I have the next problem with rowheaders:

    What is the problem??

    Thank you in advance.

  •  06-29-2009, 6:46 AM 79590 in reply to 79581

    Re: problem with appearance with rowheaders when click (+)

    Hi, 

    It seems that the Spread is not properly bound to the DataSet/DataTables. I would suggest you to refer the help file shipped along with the Spread for ASP.Net control. In the Online Help (chm) file search for "Displaying Data as a Hierarchy". It shows how to bind the nested DataSet to create a Hierarchial view in the spread. 

    Regards, 


    Scott S.
    Product Manager, Spread ASP.NET
    GrapeCity FarPoint
  •  06-29-2009, 6:48 AM 79591 in reply to 79590

    Re: problem with appearance with rowheaders when click (+)

    Thank you.

    I will revise my code.

  •  06-29-2009, 5:58 PM 79632 in reply to 79590

    Re: problem with appearance with rowheaders when click (+)

    The problem persist and i don`t know yet where is the error.

     This is the code:


    #Region "Importaciones"

    Imports FarPoint.Web.Spread.Model

    Imports System.Data

    Imports FarPoint.Web.Spread

    #End Region

    Partial Class GestionStock_Stock

    Inherits System.Web.UI.Page

    #Region "Datos Privados"

    Dim idJerarquia As String

    Dim idNivel As String

    #End Region

     

    #Region "Manejadores de eventos"

    ''' <summary>

    ''' Manejador del evento carga de la p gina

    ''' </summary>

    ''' <param name="sender"></param>

    ''' <param name="e"></param>

    ''' <remarks></remarks>

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    Try

     

    If Page.IsPostBack Then

    idJerarquia = String.Empty

    idNivel = String.Empty

    Else

    CargarDatosStock()

    idJerarquia = Request("id")

    idNivel = Request("lid")

    End If

    If idJerarquia <> String.Empty Then

    Stock.Sheets(0).ExpandRow(idJerarquia, True)

    End If

    Catch ex As Exception

    ClaseUtiles.Alerta(ex.Message)

    End Try

    End Sub

     

    ''' <summary>

    ''' Manejador del evento cambiado en check de vista jer rquica

    ''' </summary>

    ''' <param name="sender"></param>

    ''' <param name="e"></param>

    ''' <remarks></remarks>

    Private Sub chkVistaJerarquica_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkVistaJerarquica.CheckedChanged

    If chkVistaJerarquica.Checked Then

    chkMostrarEncabezados.Visible = False

    chkMostrarRutaCompleta.Visible = False

    Else

    chkMostrarEncabezados.Visible = True

    chkMostrarRutaCompleta.Visible = True

    End If

    Stock.HierarchicalView = chkVistaJerarquica.Checked

    End Sub

     

    ''' <summary>

    ''' Manejador del evento cambiado en check de mostrar encabezados

    ''' </summary>

    ''' <param name="sender"></param>

    ''' <param name="e"></param>

    ''' <remarks></remarks>

    Private Sub chkMostrarEncabezados_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkMostrarEncabezados.CheckedChanged

    Stock.HierBar.ShowParentRow = chkMostrarEncabezados.Checked

    End Sub

     

    ''' <summary>

    ''' Manejador del evento cambiado en check de mostrar ruta completa

    ''' </summary>

    ''' <param name="sender"></param>

    ''' <param name="e"></param>

    ''' <remarks></remarks>

    Private Sub chkMostrarRutaCompleta_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkMostrarRutaCompleta.CheckedChanged

    Stock.HierBar.ShowWholePath = chkMostrarRutaCompleta.Checked

    End Sub

     

    ''' <summary>

    ''' Manejador del evento de apertura de hoja hijo

    ''' </summary>

    ''' <param name="sender"></param>

    ''' <param name="e"></param>

    ''' <remarks></remarks>

    Private Sub Stock_ChildViewCreated(ByVal sender As Object, _

    ByVal e As FarPoint.Web.Spread.CreateChildViewEventArgs) _

    Handles Stock.ChildViewCreated

    Dim vistaHoja As SheetView

    vistaHoja = e.SheetView

    With vistaHoja

    '.GetChildView(0, 0).RowHeader

    .ColumnHeader.Visible = False

    .ColumnFooterHeight = 0

    If .Rows.Count = 0 Then

    Exit Sub

    End If

    .RowHeader.Visible = True

    .Columns(0).Visible = False

    .Columns(1).Visible = False

    .DefaultColumnWidth = CInt(Stock.Width.Value)

    .DataAutoCellTypes = False

    .SheetCornerStyle.Border.BorderStyle = BorderStyle.None

    .RowHeader.AutoText = FarPoint.Web.Spread.HeaderAutoText.Blank

    .RowHeader.DefaultStyle.Border.BorderStyle = BorderStyle.None

    .SheetCornerStyle.Border.BorderStyle = BorderStyle.None

    .RowHeader.Width = 20

    .Columns(1).Width = Stock.Width.Value - (20 * .ChildRelationCount)

    Dim i As Integer

    For i = 0 To .Rows.Count - 1

    .SetRowHeight(i, 30)

    .SetRowSizeable(i, False)

    .RowHeader.Rows(i).Height = 30

    If (i + .ChildRelationCount) Mod 2 = 0 Then

    .Rows(i).BackColor = Drawing.Color.WhiteSmoke

    Else

    .Rows(i).BackColor = Drawing.Color.PaleGoldenrod

    End If

    Next

    For i = 0 To .Parent.Rows.Count - 1

    .SetRowHeight(i, 30)

    .SetRowSizeable(i, False)

    .Parent.RowHeader.Rows(i).Height = 30

    Next

    End With

    End Sub

    #End Region

    #Region "M‚todos privados"

    ''' <summary>

    ''' Carga de datos en el control Stock

    ''' </summary>

    ''' <remarks></remarks>

    Private Sub CargarDatosStock()

    Dim gestor As New GestorProductos

    Dim datosStock As New DataSet()

    Dim tabla As DataTable

    Dim tablaHija As DataTable

    Dim tiposProductos As New List(Of ClaseTipoProducto)

    tiposProductos = gestor.RecuperarStock()

    tabla = datosStock.Tables.Add("Stock")

    tabla.Columns.AddRange( _

    New DataColumn() { _

    New DataColumn("id", Type.GetType("System.String")), _

    New DataColumn("Tipo de producto", Type.GetType("System.String"))})

    Stock.Sheets(0).Columns(0).Visible = False

    Stock.Sheets(0).RowHeader.Width = 20

    Stock.Sheets(0).Columns(1).Width = Stock.Width.Value - (20 * Stock.Sheets(0).ChildRelationCount)

    For Each tipo As ClaseTipoProducto In tiposProductos

    tabla.Rows.Add(New Object() {tipo.IdTipoProducto, tipo.LitNombre})

    If tipo.TiposProductos.Count > 0 Then

    tablaHija = CrearTablaTipoProductoHijo(datosStock, tipo.LitNombre)

    datosStock.Relations.Add(tipo.LitNombre, tabla.Columns("id"), tablaHija.Columns("idpadre"))

    mostrarsubtipos(datosStock, tablaHija, tipo)

    End If

    Next

    With Stock.Sheets(0)

    .SheetName = "Stock"

    .RowHeader.AutoText = FarPoint.Web.Spread.HeaderAutoText.Blank

    .DataSource = datosStock

    Dim i As Integer

    For i = 0 To .Rows.Count - 1

    .SetRowHeight(i, 30)

    .SetRowSizeable(i, False)

    .RowHeader.Rows(i).Height = 30

    If (i + .ChildRelationCount) Mod 2 = 0 Then

    .Rows(i).BackColor = Drawing.Color.WhiteSmoke

    Else

    .Rows(i).BackColor = Drawing.Color.PaleGoldenrod

    End If

    Next

    '.RowHeader.DefaultStyle.Border.BorderStyle = BorderStyle.None

    '.SheetCornerStyle.Border.BorderStyle = BorderStyle.None

    End With

    End Sub

     

     

    ''' <summary>

    ''' Procedimiento recursivo que va agregando al control los diferentes tipos

    ''' de productos

    ''' </summary>

    ''' <param name="datosStock"></param>

    ''' <param name="tabla"></param>

    ''' <param name="tipoPadre"></param>

    ''' <remarks></remarks>

    Private Sub mostrarsubtipos(ByRef datosStock As DataSet, _

    ByVal tabla As DataTable, _

    ByVal tipoPadre As ClaseTipoProducto)

    Dim subtabla As DataTable

    For Each tipoSec As ClaseTipoProducto In tipoPadre.TiposProductos

    tabla.Rows.Add(New Object() {tipoSec.IdTipoProducto, _

    tipoPadre.IdTipoProducto, _

    tipoSec.LitNombre})

    If tipoSec.TiposProductos.Count > 0 Then

    subtabla = CrearTablaTipoProductoHijo(datosStock, tipoSec.LitNombre)

    datosStock.Relations.Add(tipoSec.LitNombre, tabla.Columns("id"), subtabla.Columns("idpadre"))

    mostrarsubtipos(datosStock, subtabla, tipoSec)

    End If

    Next

    End Sub

    ''' <summary>

    ''' Crea una tabla con el formato de tipo de producto hijo

    ''' </summary>

    ''' <param name="datosStock"></param>

    ''' <param name="nombreTabla"></param>

    ''' <returns></returns>

    ''' <remarks></remarks>

    Private Function CrearTablaTipoProductoHijo(ByRef datosStock As DataSet, _

    ByVal nombreTabla As String) As DataTable

    Dim tabla As DataTable

    tabla = datosStock.Tables.Add(nombreTabla)

    tabla.Columns.AddRange( _

    New DataColumn() { _

    New DataColumn("id", Type.GetType("System.String")), _

    New DataColumn("idpadre", Type.GetType("System.String")), _

    New DataColumn("Tipo de producto", Type.GetType("System.String"))})

    Return tabla

    End Function

    #End Region

    End Class


     

  •  06-29-2009, 6:03 PM 79633 in reply to 79632

    Re: problem with appearance with rowheaders when click (+)

    And I had the next information in my database to work with the previous code:

    Table alm.TiposProductos
    =====================

     IdTipoProducto LitNombre IdPadre

    0 INFORMATICA NULL
    01 HARDWARE 0
    011 ORDENADOR 01
    012 IMPRESORA 01
    013 TECLADO 01
    02 SOFTWARE 0
    1 MOBILIARIO NULL
    11 MESA 1
    12 SILLA 1

  •  06-30-2009, 4:30 AM 79648 in reply to 79633

    Re: problem with appearance with rowheaders when click (+)

    You need to debug the CargarDatosStock() function to ensure that the relationship is getting created successfully in the dataset. 

    Can you save your dataset to xml and attach to your post so that I can try binding it to the Spread?

    Regards, 


    Scott S.
    Product Manager, Spread ASP.NET
    GrapeCity FarPoint
  •  06-30-2009, 7:36 AM 79661 in reply to 79648

    Re: problem with appearance with rowheaders when click (+)

    This is the XML from my dataset.

    Thak you.

      <?xml version="1.0" standalone="yes" ?>
    - <NewDataSet>
    - <Tipos>
      <id>0</id>
      <_x0020_>INFORMÁTICA</_x0020_>
      </Tipos>
    - <Tipos>
      <id>1</id>
      <_x0020_>MOBILIARIO</_x0020_>
      </Tipos>
    - <INFORMÁTICA>
      <id>02</id>
      <idpadre>0</idpadre>
      <Tipo_x0020_de_x0020_producto>SOFTWARE</Tipo_x0020_de_x0020_producto>
      </INFORMÁTICA>
    - <INFORMÁTICA>
      <id>01</id>
      <idpadre>0</idpadre>
      <Tipo_x0020_de_x0020_producto>HARDWARE</Tipo_x0020_de_x0020_producto>
      </INFORMÁTICA>
    - <HARDWARE>
      <id>011</id>
      <idpadre>01</idpadre>
      <Tipo_x0020_de_x0020_producto>ORDENADOR</Tipo_x0020_de_x0020_producto>
      </HARDWARE>
    - <HARDWARE>
      <id>012</id>
      <idpadre>01</idpadre>
      <Tipo_x0020_de_x0020_producto>IMPRESORA</Tipo_x0020_de_x0020_producto>
      </HARDWARE>
    - <HARDWARE>
      <id>013</id>
      <idpadre>01</idpadre>
      <Tipo_x0020_de_x0020_producto>TECLADO</Tipo_x0020_de_x0020_producto>
      </HARDWARE>
    - <MOBILIARIO>
      <id>11</id>
      <idpadre>1</idpadre>
      <Tipo_x0020_de_x0020_producto>MESA</Tipo_x0020_de_x0020_producto>
      </MOBILIARIO>
    - <MOBILIARIO>
      <id>12</id>
      <idpadre>1</idpadre>
      <Tipo_x0020_de_x0020_producto>SILLA</Tipo_x0020_de_x0020_producto>
      </MOBILIARIO>
      </NewDataSet>
  •  06-30-2009, 9:15 AM 79666 in reply to 79661

    Re: problem with appearance with rowheaders when click (+)

    I tried loading the xml in dataset and created the relationship using following code: 

            DataSet ds = new DataSet();

            ds.ReadXml(Server.MapPath(@"XMLFile.xml"));

            ds.Relations.Add("One", ds.Tables[0].Columns["id"], ds.Tables[1].Columns["idpadre"]);

            FpSpread1.DataSource = ds;

    It seems to be working fine on my side. Will it be possible for you to share a sample application along with the sample database?

    Regards, 


    Scott S.
    Product Manager, Spread ASP.NET
    GrapeCity FarPoint
  •  07-02-2009, 4:18 AM 79763 in reply to 79666

    Re: problem with appearance with rowheaders when click (+)

    I has been testing another possibilities and i dont find the solution

     I have been uploaded a sample application with the sample database in

    http://rapidshare.com/files/250968211/SpreadTest.rar.html

    You must only run database.sql to create sample database and change connection string in web.config to run the example.

    Thanks in advance for your attention.

  •  07-02-2009, 5:55 AM 79770 in reply to 79763

    Re: problem with appearance with rowheaders when click (+)

    Hi, 

    Would you please provide me with the steps that needs to be followed to replicate the issue that you are facing. Also, let me know what is the expected output that you want? When I run your sample, I do not see the hierarchial spread because you've set the Stock.HierarchicalView = False. If you change it to True, you can see the hierarchial view of the spread. 

    Regards, 


    Scott S.
    Product Manager, Spread ASP.NET
    GrapeCity FarPoint
  •  07-02-2009, 5:58 AM 79771 in reply to 79770

    Re: problem with appearance with rowheaders when click (+)

    I have put Stock.HierarchicalView = False to view titles in the hierbar but it not works correctly.

    You can see the error if you don´t click in + sign of first row inside some group...

     

     

  •  07-02-2009, 6:22 AM 79774 in reply to 79771

    Re: problem with appearance with rowheaders when click (+)

    For example if I click (+) to expand hardware it dont works corretly
  •  07-02-2009, 1:35 PM 79801 in reply to 79774

    Re: problem with appearance with rowheaders when click (+)

    Hello,

    I download the sample but could not run it to reproduce the issue at my side. However, as suggested earlier have you tried setting the HierarchicalView property to True? Also you may have a look at the "Displaying Data as a Hierarchy"section in documentation of Spread control.

    Thanks


    Suresh Singh Dasila
    GrapeCity FarPoint
View as RSS news feed in XML
     FarPoint Forums Home