Hello, i have a project radGrid editable with user control, similar to that example :
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/usercontroleditform/defaultcs.aspx
My problem is, when i click on update button on my userControl the event on my page which contains my update code, will never be fired.
i want this event above, be fired when i click on the update button on my user control.
user control code
Please help me.
Thankz in advance!
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/usercontroleditform/defaultcs.aspx
My problem is, when i click on update button on my userControl the event on my page which contains my update code, will never be fired.
i want this event above, be fired when i click on the update button on my user control.
protected
void
rgGrid_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
.GridSource.Select(
"codigo = "
+ editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex][
"codigo"
]);
if
(changedRows.Length != 1)
{
rgGrid.Controls.Add(
new
LiteralControl(
"Unable to locate the Employee for updating."
));
e.Canceled =
true
;
return
;
}
//Update new values
Hashtable newValues =
new
Hashtable();
newValues[
"codigo"
] = (userControl.FindControl(
"txtCodigo"
)
as
TextBox).Text;
newValues[
"descricao"
] = (userControl.FindControl(
"txtDescricao"
)
as
TextBox).Text;
changedRows[0].BeginEdit();
try
{
foreach
(DictionaryEntry entry
in
newValues)
{
changedRows[0][(
string
)entry.Key] = entry.Value;
}
changedRows[0].EndEdit();
this
.GridSource.AcceptChanges();
}
catch
(Exception ex)
{
changedRows[0].CancelEdit();
Window.RadAlert(
"Erro!"
, 350, 250,
"Mensagem"
,
null
);
e.Canceled =
true
;
}
}
user control code
private
object
_dataItem =
null
;
protected
void
Page_Load(
object
sender, EventArgs e)
{
}
public
object
DataItem
{
get
{
return
this
._dataItem;
}
set
{
this
._dataItem = value;
}
}
protected
void
btnUpdate_Click(
object
sender, EventArgs e)
{
// should i do something here or what?
}
Please help me.
Thankz in advance!