Respondido why gridview freezing

  • sábado, 4 de agosto de 2012 14:19
     
      Contém Código
    I am trying to figure out just what is happening to my app. when I enter a code for one of my products it populates the information for that particular product plus the raw materials used to make it(the raw materials are populated in the datagrid) . However when the user click on the remove button to remove lets say all the contents of the datagrid, after that he clears the contents of the product code textbox.and the enters the same code as before the datagrid comes out "frozen" and you can not select ap particular row.

    What is happening? When the user clears the contents of the code I clear all the textboxes and I clear the datatable as well using this code, the code textbox will be empty so it will result in a blank datatable.

    Why is my gridview "freezing" and becoming unresponsive?
    Dim myConn As OleDbConnection = frmLogIn.Conn
            Dim sql As String = "select RawMaterialCode,RawMaterialDescription,RawMaterialUnit,Include,PercentageInMix,UnitCostPerTon,CostValueInMIx,ProdRawCombo,ProductCode,ProdRawCode,RawMaterialCategory,RawMaterialFinishedGoodsGroup,RMWasteFactor,RMMoistureFactor,RMWasteValue,RMMoistureValue from ProductRawMaterial1 where ProductCode = @ProductCode"
            Dim oledbAdapter As OleDbDataAdapter = New OleDbDataAdapter(sql, myConn)
            oledbAdapter.SelectCommand.Parameters.AddWithValue("@ProductCode", txtProductCode.Text)
            oledbAdapter.Fill(myTable)
            ProductsRawMaterialGrid.DataSource = myTable


    If you think it you can achieve it

Todas as Respostas

  • segunda-feira, 6 de agosto de 2012 08:15
    Moderador
     
     

    Hi tendaimare,

    Welcome to the MSDN forum.

    Gridview is a Web UI control, so I just wondering what application you are used, WinForm application or Asp.Net application. If you use ASP.net application, please connect to ASP.net forums to ask for help: http://forums.asp.net/

    As for WinForm issue, I’m just wondering what the code it is in remove button it is. Would you like to share the code? If you textbox is bounded with the data in datatable, how about just setting the datatable to be empty OR binging noting (data) to the textbox?

    I look forward your reply.


    Mark Liu-lxf [MSFT]
    MSDN Community Support | Feedback to us

  • terça-feira, 7 de agosto de 2012 15:15
     
     Respondido
    thanks so much Mark Liu-lxf . The grid is bound to a datatable, so I ended up removing the row from the datatable directly and that did the trick 

    If you think it you can achieve it

    • Sugerido como Resposta Mark Liu-lxfModerator quarta-feira, 8 de agosto de 2012 01:30
    • Marcado como Resposta tendaimare quinta-feira, 9 de agosto de 2012 10:07
    •