Hi!
I'm trying to speed up performance in a User Control Edit Form used to edit items from a main grid. Currently, the custom edit form opens in 3-5 seconds. I've isolated the problem to a grid on the edit form which contains four RadNumericTextBox editors in each row. If I remove these, the form opens and closes in less than a second.
I followed guidance on these forums to replace the RadNumericTextBoxes with asp:TextBox and use a RadInputManager to validate the input. In the grid's ItemCreated event, I assign each TextBox to the RadInputManager's control collection. The problem is, the controls in the grid rows don't seem to pick up any of the validation. I even added a test TextBox on the form to verify that the input manager was configured correctly.
The grid columns are defined like this (I changed two of the four to TextBox for testing):
I defined the input manager as follows:
And finally, I added this handler to the grid:
txtTest validates as expected, but the textBoxes in the grid do not. What am I missing?
I'm new to Telerik and new to web development, so I apologize if it's something obvious.
Thanks,
Drew
I'm trying to speed up performance in a User Control Edit Form used to edit items from a main grid. Currently, the custom edit form opens in 3-5 seconds. I've isolated the problem to a grid on the edit form which contains four RadNumericTextBox editors in each row. If I remove these, the form opens and closes in less than a second.
I followed guidance on these forums to replace the RadNumericTextBoxes with asp:TextBox and use a RadInputManager to validate the input. In the grid's ItemCreated event, I assign each TextBox to the RadInputManager's control collection. The problem is, the controls in the grid rows don't seem to pick up any of the validation. I even added a test TextBox on the form to verify that the input manager was configured correctly.
The grid columns are defined like this (I changed two of the four to TextBox for testing):
<
telerik:GridTemplateColumn
HeaderStyle-Width
=
"100"
HeaderText
=
"Min Distance"
UniqueName
=
"MinDistance"
>
<
ItemTemplate
>
<
telerik:RadNumericTextBox
ID
=
"rntbMinDistance"
Type
=
"Number"
MinValue
=
"0"
MaxLength
=
"4"
NumberFormat-DecimalDigits
=
"0"
NumberFormat-GroupSeparator
=
""
Width
=
"40"
DbValue='<%# Eval("MinDistanceToLocation") %>'
Enabled='<%# Eval("IsIncludedInOrder") %>' runat="server" />
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderStyle-Width
=
"100"
HeaderText
=
"Max Distance"
UniqueName
=
"MaxDistance"
>
<
ItemTemplate
>
<
telerik:RadNumericTextBox
ID
=
"rntbMaxDistance"
Type
=
"Number"
MinValue
=
"0"
MaxLength
=
"4"
NumberFormat-DecimalDigits
=
"0"
NumberFormat-GroupSeparator
=
""
Width
=
"40"
DbValue='<%# Eval("MaxDistanceToLocation") %>'
Enabled='<%# Eval("IsIncludedInOrder") %>' runat="server" />
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderStyle-Width
=
"100"
HeaderText
=
"Min HSGY"
UniqueName
=
"MinHSGY"
>
<
ItemTemplate
>
<
asp:TextBox
ID
=
"txtMinHSGY"
Type
=
"Number"
Width
=
"40"
Text='<%# Eval("MinHighSchoolGraduationYear") %>'
runat="server" />
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderStyle-Width
=
"100"
HeaderText
=
"Max HSGY"
UniqueName
=
"MaxHSGY"
>
<
ItemTemplate
>
<
asp:TextBox
ID
=
"txtMaxHSGY"
Type
=
"Number"
Width
=
"40"
Text='<%# Eval("MaxHighSchoolGraduationYear") %>'
runat="server" />
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
I defined the input manager as follows:
<
telerik:RadInputManager
ID
=
"RadInputManager1"
runat
=
"server"
>
<
telerik:NumericTextBoxSetting
BehaviorID
=
"hsgyBehavior"
InitializeOnClient
=
"false"
ErrorMessage
=
"Valid year is required"
Type
=
"Number"
DecimalDigits
=
"0"
MinValue
=
"1900"
MaxValue
=
"2099"
>
<
TargetControls
>
<
telerik:TargetInput
ControlID
=
"txtTest"
/>
</
TargetControls
>
</
telerik:NumericTextBoxSetting
>
</
telerik:RadInputManager
>
And finally, I added this handler to the grid:
protected
void
rgrdLocations_ItemCreated(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridDataItem && e.Item.IsDataBound && e.Item.DataItem !=
null
)
{
NumericTextBoxSetting hsgySetting = (NumericTextBoxSetting)RadInputManager1.GetSettingByBehaviorID(
"hsgyBehavior"
);
TextBox txtMinHSGY = e.Item.FindControl(
"txtMinHSGY"
)
as
TextBox;
TextBox txtMaxHSGY = e.Item.FindControl(
"txtMaxHSGY"
)
as
TextBox;
hsgySetting.TargetControls.Add(
new
TargetInput(txtMinHSGY.UniqueID,
true
));
hsgySetting.TargetControls.Add(
new
TargetInput(txtMaxHSGY.UniqueID,
true
));
}
}
txtTest validates as expected, but the textBoxes in the grid do not. What am I missing?
I'm new to Telerik and new to web development, so I apologize if it's something obvious.
Thanks,
Drew