?
Solved

Datagrid Scrollbar Disappearing

Posted on 2006-06-06
4
Medium Priority
?
880 Views
Last Modified: 2012-08-13
Problem: The scrollbar of my datagrid disappears intermittently; I get no error messages and have no problem using the datagrid except I would have to use Down Arrow to go to the row that is not visible in the datagrid area.  I also have a situation where I get a scrollbar on the datagrid even when the rows are not enough to fill the datagrid.  In the later case, if I click on the scroll bar, I get an error "'-13'is not a valid value for 'value'. 'value' should be between 'minimum' and 'maximum'"

Background:
-- I have 1 datatable that gets the SQL results from the database every 30 seconds (Timer Interval)
-- On the form, I have 3 groups of radio buttons and 1 datagrid.  Based on the radio buttons selected, the datatable filters to the appropriate rows needed for the user on the datagrid.  
-- Right before the data table filter changes or refreshes, I set the datagrid to to nothing and refresh.  However, as soon as the filter changes and refreshing has taken effect, I set the datagrid to the datasource (The DataTable).

I have no problem with the filtering or refreshing part so far, but I have problem when the scrollbar dissapearing occassionally or appearing when not necessary (usually occurs when filter view is changed to lesser rows).

Please help me asap, I have to fix this problem within two days.  If you need more info, please let me know.  

Thank you.    
0
Comment
Question by:sargam78
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
Giant2 earned 100 total points
ID: 16850194
>I have no problem with the filtering or refreshing
It seems a refreshing problem. Do you refresh even the scrollbar and the panel of the datagrid?
0
 
LVL 9

Expert Comment

by:lojk
ID: 16851501
i usually have no need to set the datgrid to nothing... Can you not use a bind you grid to a dataview and apply the filters to that? then point the dataview at the new datatable... Dataview should then refresh itself...
0
 
LVL 9

Assisted Solution

by:lojk
lojk earned 900 total points
ID: 16851512
Ill type it without the gibberish eh?

i usually have no need to set the datgrid to nothing... Can you not use bind your grid to a dataview and apply the filters to that dataview? then point the dataview at the new datatable as required... Datagrid should then refresh itself...
0
 

Author Comment

by:sargam78
ID: 16928029
I apologize for the late reply...I'd like to thank you guys for sending your knowledgeable comments.  However, I was able to solve the issue by setting the SetDataBinding property to nothing before the filter changed and then assign the datatable to the datagrid.SetBinding property after the data table filter took place. I have done the same in the refresh code.  In another words, I have basically reset the datagrid.setDataBinding property everywhere in my code where the datatable rows change so the datagrid can sync itself to the datatable everytime.  

General example:
'----------- AutoRefresh code -------->
datagrid.SetDataBinding(Nothing, Nothing)
datagrid.DataSource = Nothing
datagrid.Refresh()

'update existing rows in datatable
OR
'import new row in datatable

datagrid.SetDataBinding(DataTable, "")
datagrid.Refresh()
datagrid.Update()

'----------- Filter code -------->
datagrid.SetDataBinding(Nothing, Nothing)
datagrid.DataSource = Nothing
datagrid.Refresh()

'filter the DT with whatever criteria is selected from the radiobuttons
      DataTable.DefaultView.RowFilter = m_Filters.QueueFilterString
      DataTable.DefaultView.Sort = "ColumnA ASC, ColumnB ASC"

datagrid.SetDataBinding(DataTable, "")
datagrid.Refresh()
datagrid.Update()


I do not refresh the scrollbar or the panel of the datagrid.  The dynamic scrollbar that comes with the datagrid object is what I always used in my code.

Thank you for your participation.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question