Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ado.net, data grid view updating

Status
Not open for further replies.

clyde11

Programmer
Feb 6, 2006
25
GB
Hello all,
I'm reading a tutorial about updating an sql table
using ado.net capabilities, in this example,
using a data grid to get input values and update the
needed row in the table, now, the problem is that
i don't really understand what is the content
of the "UpdateView()" function, i've tried several things but don't really achieve the thing updateView() need’s to do (just updating the view, after the :
"grid.EditItemIndex = e.Item.ItemIndex;")

if anyone can helps..
Best,
P.

public void EditCommand(Object sender,
DataGridCommandEventArgs e)
{
// Set the current item to edit mode
grid.EditItemIndex = e.Item.ItemIndex;

// Refresh the grid
UpdateView();
}

public void UpdateCommand(Object sender,
DataGridCommandEventArgs e)
{
// TODO: Retrieve new text and update the data source

// Reset the edit mode for the current item
grid.EditItemIndex = -1;

// Refresh the grid
UpdateView();
}

public void CancelCommand(Object sender,
DataGridCommandEventArgs e)
{
// Reset the edit mode for the current item
grid.EditItemIndex = -1;

// Refresh the grid
UpdateView();
}
 
UpdateView() is a function that rebinds the DataGrid. You do this after every time you excute you DataGridCommand(Update, Cancel, Delete) code.
 
thanks,
but what is the code inside UpdateView() ?

Best,
P.
 
I'm assuming you got this code from somewhere because you mentiobned a tutorial - consult that code. There should eb a function called UpdateView
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top