473,509 Members | 2,508 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGrid & DataView & DataGridTableStyle

Rxd
I have a Datagrid that should have a couple of hidden columns. I used a
DataGridTableStyle to hide the columns and it was working fine except I needed
to prevent the DataGrid from allowing new rows to be added. I was told to use a
DataView and set AddNew to false (thanks for the info btw) but now I can't use
the DataGridTableStyle to hide the columns I don't want. Is there any way to
have both hidden columns and disable AddNew in a DataGrid?

Thanks
Nov 15 '05 #1
3 3938
Rdx,

You could use the click event of the grid. Then, if the currentRowIndex =
datasource.Rows.count call the endInit method of the grid. this should
allow you to use a datatable as a source to allow for table mappings and
stop the user from adding new.

hope this helps

Marco
"Rxd" <rx*@aol.com> wrote in message
news:20***************************@mb-m24.aol.com...
I have a Datagrid that should have a couple of hidden columns. I used a
DataGridTableStyle to hide the columns and it was working fine except I needed to prevent the DataGrid from allowing new rows to be added. I was told to use a DataView and set AddNew to false (thanks for the info btw) but now I can't use the DataGridTableStyle to hide the columns I don't want. Is there any way to have both hidden columns and disable AddNew in a DataGrid?

Thanks

Nov 15 '05 #2
Rxd
The click event doesn't seem to fire unless you click on a header. It doesn't
fire when you click on any of the grids cells...
Nov 15 '05 #3
Rxd,
Correct, you can check for addNew when not clicking on the elipsis(*) but on
a cell of the new Row, by doing the same verification using the
CurrentCellChanged event.

datagrid.currentCell.Rownumber
Marco
"Rxd" <rx*@aol.com> wrote in message
news:20***************************@mb-m24.aol.com...
The click event doesn't seem to fire unless you click on a header. It doesn't fire when you click on any of the grids cells...

Nov 15 '05 #4

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

Similar topics

2
6486
by: Mike Irwin | last post by:
I set up sorting by various columns for a DataGrid. For one of the columns, I would like to implement my own sort algorithm, though. For example, the column contains data like: <a...
1
1893
by: Sagaert Johan | last post by:
If i delete e record through the dataView ,the record is deleted in the underlying dataset, but when calling the dataadapter.udate method the database is not updated.(altough the record is deleted...
0
5344
by: Rudolph Araujo | last post by:
Hi, I needed to build a data grid in which the first column has hyperlinks rather than simple text. I found the following code on this newsgroup and it works fine except for one problem. When I...
1
1576
by: Karine Proot | last post by:
Hello Today I had to build a DataGrid very dynamically <asp:datagrid id="dgTAB" Runat="server" AutoGenerateColumns="False" OnEditCommand="TAB_Edit" OnCancelCommand="TAB_Cancel"...
0
1453
by: Steve Kallal | last post by:
I have a DataGrid with an EditCommandColumn column set to a type of PushButton. I want to set set CssClass on these buttons and cannot without using code-behind code on the ItemDataBound event. The...
2
1514
by: Stan Sainte-Rose | last post by:
Hello, I need to know how to format Integer and Real with the datagrid. In fact, I want to use the right alignment. When I use this option the header text comes with the right alignment too. :( ...
0
1821
by: Nathan Franklin | last post by:
Hello Guys, I have been trying to work this our for so long, but I just can't seem to find the answer. I am loading a datatable from a an access database using an oledbdataadapter. I then...
1
1534
by: beachboy | last post by:
Hello all, I am using the DataSet & DataView to display the file name in specify directory e.g: 112005.html , 022006.html, 052005.html i can create a datatable by fileinfo and insert all file...
2
2160
by: ree321 | last post by:
I tried moving an ASP.net project form 1.1 to 2.0. But I am having problems with getting the OnItemDataBound function to run for a datagrid, in 2.0. It only gets called up if AutoGenerateColumns...
0
7233
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
7342
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,...
0
7410
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
7505
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
5060
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
3215
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
3201
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
774
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
440
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.