We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Multiple questions regarding data bound grid

Hi, Q1. I set the grid transparent color to true. This causes the header cell to get the backgroud color of the control. How can I disable the transparent color property only for the header cells? Q2. How can I restrict record deletion from the grid? I want to create a grid which is not possible to change? (I want to disable the delete key functionality on the grid) Q2. Is there a quick way to resize columns widths to adjust a certain client area? Q3. When I call SetColWidth in form on load event handler, the col width is not changed. Only if I call this in prepareviewstyleinfo it works fine. The problem is,I don''t want to run this code for each cell, I want it to be a part of the grid initialization, so it will be performed only once. Can you help? Q4. About grid filtering, I''m having a grid with few columns and data in it. What I want to do is to create filters on each column. As I saw in your shipped samples, I wrote the following code to create the filters: private void button2_Click(object sender,System.EventArgs e) { GridFilterBar gf = new GridFilterBar(); gf.WireGrid(gridDataBoundGrid1); } After this code is running, the filter bar is added OK, but when selecting a value from the drop down lists, the grid view is not changed. Am I missing something? Thanks a lot in advance, Gil K

3 Replies

AD Administrator Syncfusion Team May 24, 2004 07:38 AM UTC

1) If the cell style has a bitmap in its BackgroundImage property, the grid will draw the background even if its has its TransparentBackground property set. So, maybe setting this property will make this work for you. GridStyleInfo style = this.gridDataBoundGrid1.BaseStylesMap["Header"].StyleInfo; style.BackgroundImage = new Bitmap(1,1); //more or less empty 2) this.gridDataBoundGrid1.Binder.EnableRemove = false; 3) Need to set AllowResizeToFit = false to turn off the default sizing. See http://www.syncfusion.com/Support/article.aspx?id=577 4)Is you grid in some kind of dynamic spllitter like our TabBarSplitterWnd or GridRecordNavigationBar? If so, you will have to wire the filterbar in PaneCreated and unwire it in PaneClosing. See http://www.syncfusion.com/Support/article.aspx?id=580. If this does not explain what you are seeing, can you post a sample showing the problem?


AD Administrator Syncfusion Team May 25, 2004 06:59 AM UTC

Hi clay, First, the bitmap for image background and enable remove equals false, solved the problems I had. As you asked, I''m attaching to this post, a zip file with a sample of the filtering problem I I''m having. Just run the sample, click the filter button and you will see the filter bar. Try to select some value to filter, and you will see that nothing is happening. Can you make this sample work? or let me know what is wrong there? Thanks a lot Gil K >1) If the cell style has a bitmap in its BackgroundImage property, the grid will draw the background even if its has its TransparentBackground property set. So, maybe setting this property will make this work for you. > >GridStyleInfo style = this.gridDataBoundGrid1.BaseStylesMap["Header"].StyleInfo; >style.BackgroundImage = new Bitmap(1,1); //more or less empty > > >2) > >this.gridDataBoundGrid1.Binder.EnableRemove = false; > > >3) Need to set AllowResizeToFit = false to turn off the default sizing. See http://www.syncfusion.com/Support/article.aspx?id=577 > >4)Is you grid in some kind of dynamic spllitter like our TabBarSplitterWnd or GridRecordNavigationBar? If so, you will have to wire the filterbar in PaneCreated and unwire it in PaneClosing. See http://www.syncfusion.com/Support/article.aspx?id=580. > >If this does not explain what you are seeing, can you post a sample showing the problem? FilterSample_4583.zip


AD Administrator Syncfusion Team May 25, 2004 07:24 AM UTC

You can get the sample to work by changing this code gridDataBoundGrid1.DataSource = ds; gridDataBoundGrid1.DataMember = "Table1"; to gridDataBoundGrid1.DataSource = ds.Tables["Table1"]; Now the first code should also work, so we will track down the problem and correct it, but until we include the fix in an update, try using the second way of binding the datatable.

Loader.
Live Chat Icon For mobile
Up arrow icon