Hello everybody, i have one grid, and here's what i want.
I have one Edit button outside the grid, and when i click on this button, i wanna check if any item has updated, if any does, i will update that on my data table, if's not, doesnt change anything.
I tryed everything is possible and nothings helps me, the last tentative, i try to obtain my data in one foreach, e copy to one dataTable, and compare with the old dataTable, if has any changes, update, ifs not, do nothing. but withoutany success.
Someone knows how can i do that 'impossible' task?
I have one Edit button outside the grid, and when i click on this button, i wanna check if any item has updated, if any does, i will update that on my data table, if's not, doesnt change anything.
I tryed everything is possible and nothings helps me, the last tentative, i try to obtain my data in one foreach, e copy to one dataTable, and compare with the old dataTable, if has any changes, update, ifs not, do nothing. but withoutany success.
Someone knows how can i do that 'impossible' task?
<
telerik:RadGrid
ID
=
"RadGrid2"
runat
=
"server"
AllowMultiRowSelection
=
"true"
Width
=
"300px"
OnNeedDataSource
=
"RadGrid2_NeedDataSource"
OnInsertCommand
=
"RadGrid2_InsertCommand"
OnItemCreated
=
"RadGrid2_ItemCreated"
>
<
MasterTableView
AutoGenerateColumns
=
"False"
DataKeyNames
=
"codigo"
CommandItemDisplay
=
"Top"
EditMode
=
"InPlace"
>
<
Columns
>
<
telerik:GridTemplateColumn
>
<
ItemTemplate
>
<
asp:CheckBox
runat
=
"server"
ID
=
"CheckBox1"
/>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"Código"
DataField
=
"codigo"
UniqueName
=
"codigo"
ReadOnly
=
"true"
Display
=
"true"
ColumnEditorID
=
"GridTextBoxColumnEditor1"
/>
<
telerik:GridBoundColumn
HeaderText
=
"Descrição"
DataField
=
"descricao"
UniqueName
=
"descricao"
ColumnEditorID
=
"GridTextBoxColumnEditor1"
/>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
>
<
ClientEvents
OnRowDblClick
=
"RowDblClick"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
<
telerik:GridTextBoxColumnEditor
ID
=
"GridTextBoxColumnEditor1"
runat
=
"server"
TextBoxStyle-Width
=
"180px"
/>
protected
void
btnEditar_Click(
object
sender, EventArgs e)
{
// what should i do here? ...
}
protected
void
RadGrid2_ItemCreated(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridCommandItem)
{
e.Item.FindControl(
"RefreshButton"
).Visible =
false
;
e.Item.FindControl(
"RebindGridButton"
).Visible =
false
;
}
}
protected
void
RadGrid2_NeedDataSource(
object
sender, GridNeedDataSourceEventArgs e)
{
// Atribui dados a grid.
RadGrid2.DataSource =
this
.GridSource;
this
.GridSource.PrimaryKey =
new
DataColumn[] {
this
.GridSource.Columns[
"codigo"
] };
}