i have created radgrid as picture in attacment
my goals is to create empty radgrid then add the row with RadGrid Automatic Operation(performinsert())
but i can't fire the method anyway, when i click insert like attachment's picture nothing happen
i bind the grid with OnNeedDataSource with DataTable(without sqldatasource like others online tutorials)
here's the code
please help
my goals is to create empty radgrid then add the row with RadGrid Automatic Operation(performinsert())
but i can't fire the method anyway, when i click insert like attachment's picture nothing happen
i bind the grid with OnNeedDataSource with DataTable(without sqldatasource like others online tutorials)
here's the code
public
void
rg1_NeedDataSource(
object
source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
DataTable temp =
new
DataTable();
temp.Columns.Add(
"Display"
,
typeof
(
string
));
temp.Columns.Add(
"Value"
,
typeof
(
string
));
rg1.DataSource = temp;
}
public
void
rg1_ItemCommand(
object
source, Telerik.Web.UI.GridCommandEventArgs e)
{
if
(e.CommandName == RadGrid.PerformInsertCommandName)
{
GridEditableItem item = e.Item
as
GridEditableItem;
rg1.MasterTableView.PerformInsert(item);
rg1.Rebind();
//RadTextBox rbrbrbrb = new RadTextBox();
//rbrbrbrb.Text = "tes";
//radAP4.Controls.Add(rbrbrbrb);
}
}
<
telerik:RadGrid
runat
=
"server"
ID
=
"rg1"
AutoGenerateColumns
=
"true"
AllowPaging
=
"true"
GridLines
=
"None"
Width
=
"500px"
Height
=
"250px"
AllowAutomaticInserts
=
"true"
AllowAutomaticDeletes
=
"true"
AllowAutomaticUpdates
=
"true"
OnNeedDataSource
=
"rg1_NeedDataSource"
AutoGenerateEditColumn
=
"true"
AutoGenerateDeleteColumn
=
"true"
OnItemCommand
=
"rg1_ItemCommand"
> <%--OnItemInserted="rg1_ItemInserted">--%>
<
MasterTableView
runat
=
"server"
CommandItemDisplay
=
"Top"
AutoGenerateColumns
=
"true"
EditMode
=
"InPlace"
AllowAutomaticInserts
=
"true"
AllowAutomaticDeletes
=
"true"
AllowAutomaticUpdates
=
"true"
>
<
CommandItemTemplate
>
<
telerik:RadToolBar
ID
=
"rtb1"
runat
=
"server"
AutoPostBack
=
"true"
>
<
Items
>
<
telerik:RadToolBarButton
Text
=
"Edit selected"
CommandName
=
"EditSelected"
Visible='<%# rg1.EditIndexes.Count == 0 %>'></
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
Text
=
"Update"
CommandName
=
"UpdateEdited"
Visible='<%# rg1.EditIndexes.Count > 0 %>'></
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
Text
=
"Cancel editing"
CommandName
=
"CancelAll"
Visible='<%# rg1.EditIndexes.Count > 0 || rg1.MasterTableView.IsItemInserted %>'></
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
Text
=
"Add new"
CommandName
=
"InitInsert"
Visible='<%# !rg1.MasterTableView.IsItemInserted %>'></
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
Text
=
"Add this Customer"
CommandName
=
"PerformInsert"
Visible='<%# rg1.MasterTableView.IsItemInserted %>'></
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
Text
=
"Delete selected customers"
CommandName
=
"DeleteSelected"
></
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
Text
=
"Refresh customer list"
CommandName
=
"RebindGrid"
></
telerik:RadToolBarButton
>
</
Items
>
</
telerik:RadToolBar
>
</
CommandItemTemplate
>
</
MasterTableView
>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"true"
EnableDragToSelectRows
=
"true"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
please help