473,327 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Datgrid

Hi,

is there away to disable the user clicking on the datagrid row at the bottom
to create a new record , ie at moment if you click the datagrid it allows
edits whihc is ok but how do you dissalow insert from being shown.

Thanks

Neil
Nov 20 '05 #1
6 1043
> is there away to disable the user clicking on the datagrid row at the
bottom
to create a new record , ie at moment if you click the datagrid it allows
edits whihc is ok but how do you dissalow insert from being shown.


Make the datagrid read only in the properties menu.
Nov 20 '05 #2
Doing that would make it immposible to even edit datagrid ? the problem is I
dont want inserts to appear to happen by a new row being created.

hope thats clear

Thanks

"scorpion53061" <Its the end of the world as we know it@here.com> wrote in
message news:uc**************@tk2msftngp13.phx.gbl...
is there away to disable the user clicking on the datagrid row at the

bottom
to create a new record , ie at moment if you click the datagrid it allows edits whihc is ok but how do you dissalow insert from being shown.


Make the datagrid read only in the properties menu.

Nov 20 '05 #3
On 2004-01-10, Neil <ne***********@blueyonder.co.uk> wrote:
Hi,

is there away to disable the user clicking on the datagrid row at the
bottom to create a new record , ie at moment if you click the datagrid
it allows edits whihc is ok but how do you dissalow insert from being
shown.


The specifics depend on exactly what you're binding to, but the way to
do this is to turn off the ability to add new records in your data
source, rather than doing anything to the grid specifically.

Public Sub BindGrid(DataGrid dg, DataTable dt)
dt.DefaultView.AllowNew = False
dg.DataSource = dt
End Sub
--
David
dfoster at
hotpop dot com
Nov 20 '05 #4
What you need to do is use a DataView as your grid datasource, and set your
DataView.AllowNew property to false.

The code is something like:
' Assumes you are using a DataTable as the original datasource
Sub SetupGrid(myDataTable as DataTable)
dim myDataView as DataView
myDataView = new DataView(myDataTable)
myDataView.AllowNew = False

myGrid.DataSource = myDataView
End Sub

"Neil" <ne***********@blueyonder.co.uk> wrote in message
news:Q1******************@news-binary.blueyonder.co.uk...
Doing that would make it immposible to even edit datagrid ? the problem is I dont want inserts to appear to happen by a new row being created.

hope thats clear

Thanks

"scorpion53061" <Its the end of the world as we know it@here.com> wrote in
message news:uc**************@tk2msftngp13.phx.gbl...
is there away to disable the user clicking on the datagrid row at the

bottom
to create a new record , ie at moment if you click the datagrid it allows edits whihc is ok but how do you dissalow insert from being shown.


Make the datagrid read only in the properties menu.


Nov 20 '05 #5
Brilliant yep just what I wanted , managed to get it working in my scenario
Thank you scorpion53061 and also David for replying.

Neil

"scorpion53061" <Its the end of the world as we know it@here.com> wrote in
message news:%2***************@TK2MSFTNGP11.phx.gbl...
What you need to do is use a DataView as your grid datasource, and set your DataView.AllowNew property to false.

The code is something like:
' Assumes you are using a DataTable as the original datasource
Sub SetupGrid(myDataTable as DataTable)
dim myDataView as DataView
myDataView = new DataView(myDataTable)
myDataView.AllowNew = False

myGrid.DataSource = myDataView
End Sub

"Neil" <ne***********@blueyonder.co.uk> wrote in message
news:Q1******************@news-binary.blueyonder.co.uk...
Doing that would make it immposible to even edit datagrid ? the problem is
I
dont want inserts to appear to happen by a new row being created.

hope thats clear

Thanks

"scorpion53061" <Its the end of the world as we know it@here.com> wrote

in message news:uc**************@tk2msftngp13.phx.gbl...
> is there away to disable the user clicking on the datagrid row at the bottom
> to create a new record , ie at moment if you click the datagrid it

allows
> edits whihc is ok but how do you dissalow insert from being shown.

Make the datagrid read only in the properties menu.



Nov 20 '05 #6
No problem.

You can find solutions like this in the VB.NET/ADO.NET Newsgroup Search Tool
at http://www.kjmsolutions.com/newsgrouptool.htm
"Neil" <ne***********@blueyonder.co.uk> wrote in message
news:8n*****************@news-binary.blueyonder.co.uk...
Brilliant yep just what I wanted , managed to get it working in my scenario Thank you scorpion53061 and also David for replying.

Neil

"scorpion53061" <Its the end of the world as we know it@here.com> wrote in
message news:%2***************@TK2MSFTNGP11.phx.gbl...
What you need to do is use a DataView as your grid datasource, and set your
DataView.AllowNew property to false.

The code is something like:
' Assumes you are using a DataTable as the original datasource
Sub SetupGrid(myDataTable as DataTable)
dim myDataView as DataView
myDataView = new DataView(myDataTable)
myDataView.AllowNew = False

myGrid.DataSource = myDataView
End Sub

"Neil" <ne***********@blueyonder.co.uk> wrote in message
news:Q1******************@news-binary.blueyonder.co.uk...
Doing that would make it immposible to even edit datagrid ? the
problem is
I
dont want inserts to appear to happen by a new row being created.

hope thats clear

Thanks

"scorpion53061" <Its the end of the world as we know it@here.com>
wrote in message news:uc**************@tk2msftngp13.phx.gbl...
> > is there away to disable the user clicking on the datagrid row at the > bottom
> > to create a new record , ie at moment if you click the datagrid it
allows
> > edits whihc is ok but how do you dissalow insert from being shown.
>
> Make the datagrid read only in the properties menu.
>
>



Nov 20 '05 #7

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

Similar topics

0
by: Mike | last post by:
Hi, I am having problems with my program, the problem is it will not put the datagrid into edit mode. The .aspx page has the following code in it : - <asp:datagrid id="DataGrid2"...
2
by: Atif Jalal | last post by:
Hi, I would like to know if there is a way to print 'Sum' of all the values of one of the columns in a datagrid in an ASP.net application using vb.net. The Sum should be displayed all the way at...
2
by: SKG | last post by:
how can i avoid datagrid from showing sql bit values as true or false. TIA
2
by: Steve Wark | last post by:
Whats the easiest way to update data being displayed in a datagrid from SQL every 2-3 minutes. For instance, a user brings up a web page page that is monitoring an alarm list stored in a SQL...
1
by: Ruben | last post by:
I have this code DataGrid1.DataSource = inventario(cint(TextBox1.Text)) but a want sent a val string and not a int, how I do that
0
by: John Smith | last post by:
I am trying to add a HyperLinkField to a datagrid programatically, but I keep running into the error: "CS1502: The best overloaded method match for...
1
by: Alan | last post by:
Dear all, I use VB.NET to develop a DATAGIRD, in the grid, there is a ASP Button Colum, I want to delete the record by clicking the delete button However, when I use the LINKBUTTON, it can,...
4
by: Richard Fagen | last post by:
Hi, Is there a simple way to read the current value in a datagrid's cell? I know how to use Grid.CurrentCell.RowNumber Grid.CurrentCell.ColumnNumber but these give me the co-ordinates of the...
2
by: 1980dinesh | last post by:
Hi, I have a DatGrid and i have added a checkboxes as template column i have write javascipt code to check and unckeck but at button event of code behind i can't grab the (checked) true condition...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.