none
Existe vantagem em utilizar o ListView e nao o GridView ? RRS feed

  • Pergunta

  • Olá Pessoal ,

    sempre utilizei o gridview em minhas aplicações,porém queria mostrar apenas duas colunas (cod e descricao de clientes ) , para selecao do usuario.Pesquisei e descobri que manipular o ListView é bem mais complexo que o GridView (a ListView deve ser configurada até no html , desenhar a table , coluna , depois para marcar a linha tb , teria que usar um css).Bom...queria ajuda dos experientes...Qual a vantagem ???

    segunda-feira, 10 de setembro de 2012 15:04

Respostas

  • E ae tucão, blz cara?

    Eu respondi uma pergunta parecida aqui nesta thead :

    http://social.msdn.microsoft.com/Forums/pt-BR/vsvbasicpt/thread/a5b3b4e1-f848-47ef-9273-1fdefba84a63

    Assim, a grande vantagem é que o ListView permite você customizar bem melhor o seu layout do que o GridView.

    Segue um link bem bacana com uma comparação entre os principais componentes do Asp.Net

    http://weblogs.asp.net/anasghanem/archive/2008/09/06/comparing-listview-with-gridview-datalist-and-repeater.aspx


    Se a resposta foi útil por favor qualifique! Janderson Candido de Mattos - MCTS

    • Sugerido como Resposta Lucas Vandor segunda-feira, 10 de setembro de 2012 15:26
    • Marcado como Resposta Harley Araujo quarta-feira, 12 de setembro de 2012 20:28
    segunda-feira, 10 de setembro de 2012 15:23
  • veja

    The ListView control is a new data presentation control that was added in ASP.Net 3.5.You may wonder why its added to the framework , and what it provide .

    From what i have seen, ListView control was added to provide The following functionalities :

      • A very flexible and customizable layout.
      • A built in data paging support with the new DataPager control.
      • Support data grouping (repeating items) in a flexible way.
      • Built in support for deleting,inserting,paging,sorting,and updating the data.

    Now , to compare the ListView control with the dataList,GridView and repeater control , lets look at the table below : 

    Supported Funcationalities
    Control Paging Data Grouping Provide Flexible Layout Update,Delete Insert Sorting
    ListView supported supported supported supported supported supported
    GridView supported Not supported Not Supported supported Not Supported supported
    DataList Not supported supported supported Not supported Not supported Not supported
    Repeater Not supported Not supported supported Not supported Not supported Not supported

    * Supported: means that it's provided out of the box without any custom code or hacks.

    * Not Supported: means that it's not provided out of the box by the control but it could be possible to implement it using custom code \ hacks.

    The GridView : it supports paging but it doesn't provide a flexible layout , since its mainly used to display the data in a table based layout.And If we looked at data inserting , the Gridview doesn't have a built in support for inserting data( since it doesn't call the insert method of it underlying data source when you click on a button with a CommadName set to "Insert" ).

    The DataList : it support data grouping ( through its RepeatColumns property) , but it doesn't have a built in support for paging,inserting ,deleting , updating the data. and if you looked at its laout , you will find that by default  the datalist renders as html table and you will have to set its flowLayout to "Flow" to stop that behaviour.

    The Repeater control : you will find that it provides a flexible layout but it doesn't support data grouping ,inserting,deleting , updating  and paging through the data .


    Não esqueça de usar o componente </> na barra para posta seu código. Microsoft MCPD,MCTS,MCC

    • Marcado como Resposta Harley Araujo quarta-feira, 12 de setembro de 2012 20:28
    terça-feira, 11 de setembro de 2012 19:58
    Moderador

Todas as Respostas

  • E ae tucão, blz cara?

    Eu respondi uma pergunta parecida aqui nesta thead :

    http://social.msdn.microsoft.com/Forums/pt-BR/vsvbasicpt/thread/a5b3b4e1-f848-47ef-9273-1fdefba84a63

    Assim, a grande vantagem é que o ListView permite você customizar bem melhor o seu layout do que o GridView.

    Segue um link bem bacana com uma comparação entre os principais componentes do Asp.Net

    http://weblogs.asp.net/anasghanem/archive/2008/09/06/comparing-listview-with-gridview-datalist-and-repeater.aspx


    Se a resposta foi útil por favor qualifique! Janderson Candido de Mattos - MCTS

    • Sugerido como Resposta Lucas Vandor segunda-feira, 10 de setembro de 2012 15:26
    • Marcado como Resposta Harley Araujo quarta-feira, 12 de setembro de 2012 20:28
    segunda-feira, 10 de setembro de 2012 15:23
  • única diferença é que o ListView você pode customizar muito mais o layout do que a GridView. porém, o ViewState da List é enorme.

    Se a resposta foi útil por favor qualifique. Italo Biguzi Duarte, Desenvolvedor ASP.NET C#, Italo.biguzzi@gmail.com

    terça-feira, 11 de setembro de 2012 16:33
  • veja

    The ListView control is a new data presentation control that was added in ASP.Net 3.5.You may wonder why its added to the framework , and what it provide .

    From what i have seen, ListView control was added to provide The following functionalities :

      • A very flexible and customizable layout.
      • A built in data paging support with the new DataPager control.
      • Support data grouping (repeating items) in a flexible way.
      • Built in support for deleting,inserting,paging,sorting,and updating the data.

    Now , to compare the ListView control with the dataList,GridView and repeater control , lets look at the table below : 

    Supported Funcationalities
    Control Paging Data Grouping Provide Flexible Layout Update,Delete Insert Sorting
    ListView supported supported supported supported supported supported
    GridView supported Not supported Not Supported supported Not Supported supported
    DataList Not supported supported supported Not supported Not supported Not supported
    Repeater Not supported Not supported supported Not supported Not supported Not supported

    * Supported: means that it's provided out of the box without any custom code or hacks.

    * Not Supported: means that it's not provided out of the box by the control but it could be possible to implement it using custom code \ hacks.

    The GridView : it supports paging but it doesn't provide a flexible layout , since its mainly used to display the data in a table based layout.And If we looked at data inserting , the Gridview doesn't have a built in support for inserting data( since it doesn't call the insert method of it underlying data source when you click on a button with a CommadName set to "Insert" ).

    The DataList : it support data grouping ( through its RepeatColumns property) , but it doesn't have a built in support for paging,inserting ,deleting , updating the data. and if you looked at its laout , you will find that by default  the datalist renders as html table and you will have to set its flowLayout to "Flow" to stop that behaviour.

    The Repeater control : you will find that it provides a flexible layout but it doesn't support data grouping ,inserting,deleting , updating  and paging through the data .


    Não esqueça de usar o componente </> na barra para posta seu código. Microsoft MCPD,MCTS,MCC

    • Marcado como Resposta Harley Araujo quarta-feira, 12 de setembro de 2012 20:28
    terça-feira, 11 de setembro de 2012 19:58
    Moderador