Hi Team
Please help me to resolve my issue with gridview refresh.
I am using ULTRAGRID View for displaying user information. There is a tabbed manager control in my MDI form
The user details screen is having Add user toolbar. When clicked on this it will open another tab for adding user. When the user is added to the db, onclosing event of this form I am refreshing the user details screen (ie re binding the data from db.) but the data inside the gridview is not reloading (not able to see the newly added record)
I am using VB.net
//User Add formclose event.
Private Sub frmUserAdd_FormClosing(sender As System.Object, e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
Using frmU As New frmUser
frmU.RefreshGrid()
End Using
End Sub
//Below is the code for Gridview details page refreshGrid
Public Sub RefreshGrid() Try Dim RmUser As New RateMappingUser() Dim ds As New DataSet RmUser.connectionString = gHiveConnectionString ds = RmUser.GetAllUsers() grdAllUsers.DataSource = ds.Tables(0) If grdAllUsers.Rows.Count > 0 Then grdAllUsers.Rows(0).Selected = True End If CommonSettings.SetGridSettings(grdAllUsers) Catch ex As Exception Using frmErr As New frmException(ex.Message, ex.InnerException.ToString()) frmErr.ShowDialog() End Using End Try End Sub End Class
Thanks in advance
Hi,
There's really no enough information here for me to go on. I don't know what most of these objects are, so there's no way for me to even guess what this code is supposed to do.
For what I can see, if looks like you are creating a form that gets the data from the data base and creates a new DataSet. And then presumably your users are modifying that data set, but this will not have any effect on the back end you somehow commit those changes. And the you could will have to update the existing DataSet (or whatever data source you are using) for your user information screen.
Maybe I am wrong, but if that's what you are doing, it's a very convoluted and different way to achieve what you want. It would be a lot easier to use the existing DataSet you already have in memory instead of going back to the DataBase.
Hi Mike
I willl rephrase my question for your understanding
I am filling the ultra grid with a dataset and this screen is opened by the user. There is another screen which is opened in tabbed view and some data is modified (underlaying table is same for grid and this screen). How should I refresh the ultra grid when the modified screen is closed.
I tried to use Refresh method of the grid but it was not given the expected result.