This is a migrated thread and some comments may be shown as answers.

Update button in EditForm

0 Answers 19 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Iris
Top achievements
Rank 1
Iris asked on 07 Aug 2012, 02:29 AM
I have an Update button in template editForm. My problem is that I cannot implement the button. I have seen this demo (http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/usercontroleditform/defaultcs.aspx) and tried to implement the RadGrid1_UpdateCommand event handler, but I got compilation errors for this line:

DataRow[] changedRows = this.UserDataSource.Select("user_id = " + editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["Users"]);

The errors are:
1. "The best overloaded method match for 'System.Web.UI.WebControls.SqlDataSource.Select(System.Web.UI.DataSourceSelectArguments)' has some invalid arguments"
2. "Argument 1: cannot convert from 'string' to 'System.Web.UI.DataSourceSelectArguments'"

Can anyone help me on this?

Here's the code for the UpdateCommand event handler:
protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e)
{
   GridEditableItem editedItem = e.Item as GridEditableItem;
   UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
 
   //Prepare new row to add it in the DataSource
   DataRow[] changedRows = this.UserDataSource.Select("user_id = " + 
        editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["Users"]);
 
// in progress. to be implemented here
}

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Iris
Top achievements
Rank 1
Share this question
or