Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'd like for the user to have the ability to make changes to the datagrid, just not allow add/delete rows in the datatable. (not exactly read only) My apologies for not explaining myself that well.

 

I can work around this so that the newly add/deleted valules aren't applied to the database, but seems somewhat like a sloppy method.

 

I should likely reconsider having separate add/delete forms for this particular section of my application.

 

However, if anyone knows of a way or has a suggestion on how I may accomplish what I'm trying to do with a datatable I'd really like to hear it :D

~~ The One Who Was ~~
Posted

You can allways declare the datarow 'WithEvents' and grab the 'RowChanging' event of it... there you can:

   Private Sub dt_RowChanging(ByVal sender As Object, ByVal e As System.Data.DataRowChangeEventArgs) Handles dt.RowChanging
       If e.Action = DataRowAction.Add Then
           'Validate whatever you want...
       End If
   End Sub

 

Alex :p

Software bugs are impossible to detect by anybody except the end user.
Posted (edited)

As he's using some 3rd party column styles dor the datagrid they (the columns) must be somehow confused with the header names... who know what kind of code is behind those "custom columns"??

 

Wouldn't it be sheaper to buy a whole new grid component?

Even if not I think it would allways be better, the diference can't be so big...

 

http://www.devexpress.com ... XtraGrid component... rulezzzz

 

Alex :p

Edited by AlexCode
Software bugs are impossible to detect by anybody except the end user.
Posted

Yeah, it's really wierd that these column styles would prevent me from using a dataview =/

 

Thanks for the tip on the datagrid Alex. I'll check it out.

 

I was looking at one from syncfusion, but it was rather pricey for the amount I'll be using it.

~~ The One Who Was ~~
Posted

I've tryed almost every grid component... XtraGrid won... no doubt about it...

 

Alex :p

Software bugs are impossible to detect by anybody except the end user.
Posted

I'm sorry about the link error... :(

I use almost all DevExpress .net controls and they're all great and on top of this, the support repplyes to in 24hours max...

 

Alex :P

Software bugs are impossible to detect by anybody except the end user.
Posted
JABE' date=' the problem is that he said the datgrid doesn't take kindly to Dataviews, I'm not really sure why though. :([/quote']

 

Oh, I guess I was thrown off by his initial question:

 

I was curious if anyone knew of a way to make a data table prevent adding/deleting records using a dataview??

 

Anyway, if the datagrid is bound to a datatable instead, it's just a matter of getting to the DefaultView of the datatable:

 

CType(theDataGrid.DataSource, DataTable).DefaultView.AllowDelete = False

CType(theDataGrid.DataSource, DataTable).DefaultView.AllowNew = False

Posted
Oh, I guess I was thrown off by his initial question:

 

 

 

Anyway, if the datagrid is bound to a datatable instead, it's just a matter of getting to the DefaultView of the datatable:

 

CType(theDataGrid.DataSource, DataTable).DefaultView.AllowDelete = False

CType(theDataGrid.DataSource, DataTable).DefaultView.AllowNew = False

 

LOL Aye. that would do it. I'm sorry about Jabe.

 

Thanks for the reply. I'll try that out. May save me some money... and then I can buy that other grid control after I pay my income tax! :D

~~ The One Who Was ~~

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...