473,785 Members | 2,919 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Column Width in DataGrid When using DataView

How do I set the column width in a datagrid when the datasource is a
dataview? I want to use a dataview so data changes, inserts, and deletes are
disabled.

I can set the column width when I use the DataTable that underlies the
DataView as the DataSource in the DataGrid. When I use the DataTable name as
the MappingName in the DataGridTableSt yle, it works like a charm.

However, when I change the DataGrid.DataSo urce to the DataView, I don't know
what MappingName to put in its DataGridTableSt yle. No matter what I put as a
MappingName, the values in the GridColumnStyle s.columnwidth are ignored. The
column names show up in the combobox in the GridColumnStyle s so it sees data
from the dataview.

Any ideas on what I should do?
--
Price Brattin
Certified MBS/Solomon Consultant
SQLServer MCP
VB.Net Developer

Nov 21 '05 #1
1 2779
Hi,

The mappingname for the dataview will be the same as the
datatable's.

Ken
-----------------
"Price Brattin" <pb******@bueno sw.com.(donotsp am)> wrote in message
news:23******** *************** ***********@mic rosoft.com...
How do I set the column width in a datagrid when the datasource is a
dataview? I want to use a dataview so data changes, inserts, and deletes
are
disabled.

I can set the column width when I use the DataTable that underlies the
DataView as the DataSource in the DataGrid. When I use the DataTable name
as
the MappingName in the DataGridTableSt yle, it works like a charm.

However, when I change the DataGrid.DataSo urce to the DataView, I don't
know
what MappingName to put in its DataGridTableSt yle. No matter what I put as
a
MappingName, the values in the GridColumnStyle s.columnwidth are ignored.
The
column names show up in the combobox in the GridColumnStyle s so it sees
data
from the dataview.

Any ideas on what I should do?
--
Price Brattin
Certified MBS/Solomon Consultant
SQLServer MCP
VB.Net Developer

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4272
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 several examples on the web. They all seem to have problems, though that I've been unable to resolve. The most promising example I have found is at:
0
1707
by: VMI | last post by:
My Windows datagrid has two columns: one with the data that the user will see (col_X) and the other one (a hidden one: col_sort) that'll be used to sort data. When a user clicks on col_X's column header, I'm intercepting the header click and "telling" it to sort the dataview using col_sort. But for some reason, the "return" is not being executed. When I press the mouse key, it'll sort correctly (by col_sort), but as soon as I release the...
1
4048
by: Dmitry V. Markin | last post by:
Good day! Here is my problem: I need to have a radiobutton column in my DataGrid for a representation of a bool column, where only row can be checked at one time(only one value in bool column can be true). So I've created a class inheriting from DataGridColumnStyle and added the following code to the class: protected RadioButton rb ; ....
6
2749
by: Agnes | last post by:
I understand it is impossible, but still curious to know "Can I freeze several column in the datagrid, the user can only scroll the first 3 columns (not verical), for the rest of the coulumn, it is freeze.
8
6371
by: Doug Bell | last post by:
Hi, I need to create a function that will return the number of columns in a passed reference to a DataView. I can find the number of columns in its underlying Data table but have not been able to find a way of determining the column count in the DataView. Thanks for any assistance.
5
1751
by: Bruce D | last post by:
Is there a way to programatically set the format of just one column in a datagrid? I have a datagrid bined to a datasource. My dataview has 6 columns. And I want to format one column ('amount')...without have to mess with all the other columns. If I use DataGridTableStyle() and DataGridTextBoxColumn() (see following code)...my datagrid only displays 1 column! Dim dvFinders As New DataView(dtFinders) DataGrid1.DataSource = dvFinders...
5
3701
by: Rich | last post by:
I have a datagrid that uses a dataview object for its datasource. The dataview contains a unique row identifier column. I don't want to display this column in the datagrid. I need the unique row Identifier column so that I can run updates on the SqlAdapter object. Is there a way to hide this column from the datagrid? Dim dv1 As New DataView(ds.Tables("tbl1")) dv1.AllowNew = False dgr1.DataSource = dv1 '--dgr1 is the datagrid
9
6107
by: Steve | last post by:
How I can remove an AutoGenerated column? I wnat to inlcude the primary key in the resultset for creating some custom LinkButtons, but I don't want it (the PK) displayed in the DataGrid. I tried searching the columnheader text, but found that AutoGenerated columns are members of the Columns collection. From the msdn documentation: Note: When the AutoGenerateColumns property is set to true, the columns created by the DataGrid control are...
3
4685
by: Aziz | last post by:
1. I have a shopping basket DataGrid with a list of products. What I want to do is when the user clicks on a row, a button will become visible/be created that allows user to edit the quantity. The button will be dynamic and always show up on the same Y-axis position as the selected row. So, how do I get back the X, Y co-ordinates of a specific row in a datagrid relative to the form? 2. I managed to change individual column width using:
0
9643
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10319
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7496
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5380
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2877
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.