Please help
I have the following situation:
radgrid with custom template and editmode set to editformtype="template" and editmode="editforms". Also, defined
On the second button I am trying to bubble grid update from button control that is outside the radgrid like this:
The corresponding event handlers bubble but I can`t get values from custom template radtextboxes:
I tried like this:
But the value of txtInicijali.text is always string.empty.
How can get values from custom template?
Is there a better way to accomplish update from button outside the radgrid?
Another problem that I have:
I have defined <ItemTemplate></ItemTemplate> and <FormTemplate> and grid is in edit mode it shows both templates - does not hide itemtemplate! I want to item template and editformtemplate be the same.
Please help!
I have the following situation:
radgrid with custom template and editmode set to editformtype="template" and editmode="editforms". Also, defined
OnUpdateCommand="RadGrid2_UpdateCommand
for the first version and
OnItemCommand="RadGrid1_ItemCommand"
for the second version.
First I put radgrid item in editmode with first button:
RadGrid2.EditIndexes.Add(0);
RadGrid2.Rebind();
On the second button I am trying to bubble grid update from button control that is outside the radgrid like this:
if (commandButton.CommandName.ToLower() == "update")
{
foreach (GridEditFormItem item in RadGrid2.MasterTableView.GetItems(GridItemType.EditFormItem))
{
RadGrid2.MasterTableView.PerformUpdate(item, true); // first version
item.FireCommandEvent("Update", string.Empty); //second version
}
The corresponding event handlers bubble but I can`t get values from custom template radtextboxes:
<
EditFormSettings
EditFormType
=
"Template"
>
<
EditColumn
UniqueName
=
"EditColumn"
></
EditColumn
>
<
FormTemplate
>
<
div
>
<
tr
>
<
td
>
Inicijali
</
td
>
<
td
>
<
telerik:RadTextBox
ID
=
"Inicijali"
runat
=
"server"
Font-Names
=
"Verdana"
Font-Size
=
"Small"
Text='<%# Bind("Inicijali") %>'>
</
telerik:RadTextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
>
Kratica imena
</
td
>
<
td
>
<
telerik:RadTextBox
ID
=
"KraticaImena"
runat
=
"server"
Font-Names
=
"Verdana"
Font-Size
=
"Small"
Text='<%# Bind("KraticaImena") %>'>
</
telerik:RadTextBox
>
</
td
>
</
tr
>.....</
table
>
RadGrid definition:
<
telerik:RadGrid
ID
=
"RadGrid2"
runat
=
"server"
DataSourceID
=
"DetailsViewSQLDataSource"
AutoGenerateColumns
=
"false"
OnUpdateCommand
=
"RadGrid2_UpdateCommand"
OnItemCommand
=
"RadGrid1_ItemCommand"
AllowAutomaticUpdates
=
"true"
>
<
MasterTableView
DataSourceID
=
"DetailsViewSQLDataSource"
AutoGenerateColumns
=
"true"
DataKeyNames
=
"IdOsobe"
ShowHeader
=
"false"
EditMode
=
"EditForms"
AllowAutomaticInserts
=
"true"
>
I tried like this:
protected
void
RadGrid2_UpdateCommand(
object
sender, GridCommandEventArgs e)
{
if
(e.CommandName == RadGrid.UpdateCommandName)
{
if
(e.Item
is
GridEditFormItem)
{
GridEditFormItem item = (GridEditFormItem)e.Item;
int
id = Convert.ToInt32(item.GetDataKeyValue(
"IdOsobe"
));
if
(id != 0)
{
RadTextBox txtInicijali =
(RadTextBox)item.FindControl(
"Inicijali"
);
RadGrid1.Rebind();
}
}
}
}
But the value of txtInicijali.text is always string.empty.
How can get values from custom template?
Is there a better way to accomplish update from button outside the radgrid?
Another problem that I have:
I have defined <ItemTemplate></ItemTemplate> and <FormTemplate> and grid is in edit mode it shows both templates - does not hide itemtemplate! I want to item template and editformtemplate be the same.
Please help!