The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I have a datagrid bound to a datatable. I also have a text box that uses DataBindings.Add to bind to a column in the datatable. When I move rows in the grid the text box tracks the change and displays text from the current grid row for the bound column.
If I edit the text in the text box the change is mirrored in the datagrid. Does anyone know how I can prevent changes to the text box altering the text in the grid ?
I've been trying to do this using DataRowVersion without luck, the only other way I can think of is to forget databinding and track row changes in the grid and read the value of a cell - which means writing alot more code :(
Nic, unfortunately setting the text box as read only prevents users typing into it, however, the text box is used to enter a search string. When a user clicks a row in the grid the text box is auto populated (via its databinding) with data from the selected grid row. The user can 'tweak' this string before running the search. What I'm after is a way to get the grid to display the original row version, rather than the current version, or a way to undo / rollback any changes the user makes in the text box.
NINicMay 25, 2003 11:26 AM UTC
If you say that DataRowVersion doesn't work for you,try with DataBinding events Format & Parse.
In code part where you bind TextBox1 to DataSource, add handler for those events:
TextBox1.Databidings.Add("Text", _
dsTmp.Table1, "Column1Name")
....
AddHandler TextBox1.DataBindings(0).Format, _ AddressOf FromDataTable
AddHandler TextBox1.DataBindings(0).Parse, _ AddressOf ToDataTable
Private Sub ToDataTable(ByVal sender As _ Object, ByVal e As ConvertEventArgs)
Try
e.Value = originalString
Catch
End Try
End Sub
Private Sub FromDataTable(ByVal sender As _ Object, ByVal e As ConvertEventArgs)
Try
originalString = CStr(e.Value)
Catch
End Try
End Sub
On Class level declare:
Dim originalString as String=""
Only downside is in dsTmp.GetChanges. Format event changes Column1 in current DataRow,
but only those DataRows where user modified text in TextBox1.
Hope this helps
Nic