473,493 Members | 4,355 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Datagrid

16 New Member
how can i refres a datagrid or close and open it again.
Mar 1 '07 #1
4 893
radcaesar
759 Recognized Expert Contributor
What you want to do exactly ?

:)
Mar 1 '07 #2
sachinkale
16 New Member
I have written below code

Expand|Select|Wrap|Line Numbers
  1. Try
  2.             DG.TableStyles.Clear()
  3.             DG.Refresh()
  4.             sp_cnt = 0
  5.  
  6.  
  7.             DG.TableStyles.Clear()
  8.             tablestyle.MappingName = mdetabname
  9.             tablestyle.HeaderBackColor = System.Drawing.Color.Pink
  10.             'tablestyle.MappingName.Remove(0, Len(mdetabname))
  11.  
  12.  
  13.             Do
  14.                 If sacarray(sp_cnt) <> "" Then
  15.                     Dim tablestyle2 As New DataGridTextBoxColumn
  16.                     ' MsgBox(TableStyle1(0).ToString())
  17.                     tablestyle2.MappingName = sacarray(sp_cnt)
  18.                     tablestyle2.Width = 100
  19.                     tablestyle2.HeaderText = MappArray(sp_cnt)
  20.                     MsgBox(sacarray(sp_cnt) & " " & MappArray(sp_cnt))
  21.  
  22.                     tablestyle.GridColumnStyles.Add(tablestyle2)
  23.                     tablestyle2.Dispose()
  24.                     sp_cnt = sp_cnt + 1
  25.  
  26.                 Else
  27.                     Exit Do
  28.                 End If
  29.             Loop
  30.  
  31.  
  32.             DG.TableStyles.Add(tablestyle)
  33.             DG.Refresh()
sacarray() - I have taken different fields using string operation from 12 different select statements statement and stored it in "sacarray".
for

MappArray() - I m taking values from database and storing it in this array.

there are 50 different rows fro mapping array
these 50 rows are divided into 12 tables.

and mapping these two array in above code


At first it runs fine.
but when i try to apply different combination i m getting following error:

"Error: Datagrid columnstyle collection already contains a columnstyle
with the same mapping "
parameter name: column

please clarify how i can remove a columnstyle from a datagrid before applying new one.
Mar 1 '07 #3
kenobewan
4,871 Recognized Expert Specialist
I believe that you can use GridColumnStyles.clear() to clear all column styles or GridColumnStyles.remove(tablestyle2) just to remove that one.
Mar 1 '07 #4
sachinkale
16 New Member
Thank You very much

I stored that datagridcolumnstyle to an array before adding.
and using that array i removed datagridcolumnstyle one bye one before adding new tablestyle.

I had worked on that code for 3 days so thanx once again.....
Mar 2 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

8
7882
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the...
3
4234
by: Bill C. | last post by:
Hello, I know this has been discussed a lot already because I've been searching around for information the last few weeks. I'm trying to implement a DataGridComboBoxColumn class. I've found...
5
9164
by: BBFrost | last post by:
Win2000 ..Net 1.1 SP1 c# using Visual Studio Ok, I'm currently in a "knock down - drag out" tussle with the .Net 1.1 datagrid. I've come to realize that a 'block' of rows highlighted within...
2
4315
by: pei_world | last post by:
I want to implement a key hit with enter to dropdown a combobox that is in the datagrid. in this case I need to override its original behaviours. I found some codes from the web. Does anyone know...
1
4275
by: Rick | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls...
3
2769
by: CVerma | last post by:
Hi, I have an embedded datagrid within a datalist. I am not able to perfrom paging in the datagrid. Any ideas? Here is my code: Here is my Simplegrid.cs file: using System; using...
2
6371
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
7
5653
by: Dave | last post by:
Are there any add-on products or samples available that can do the following in an vb.net datagrid I want to compare 2 rows in a datagrid - one row from one database and another row for another...
9
2706
by: rn5a | last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB table. Users can modify the records using this DataGrid for which I am using EditCommandColumn in the DataGrid. This is the...
2
6556
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click...
0
7118
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6980
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7192
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7364
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4886
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3087
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
282
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.