protected
void rgMembers_ItemCreated(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem edititem = (GridEditableItem)e.Item;
/ /validate Percentage
GridTextBoxColumnEditor editorP = (GridTextBoxColumnEditor)edititem.EditManager.GetColumnEditor("Percentage");
TableCell cellP = (TableCell)editorP.TextBoxControl.Parent;
RangeValidator validatorP = new RangeValidator();
validatorP.ID =
"rgvPercentage";
validatorP.ControlToValidate = editorP.TextBoxControl.ID; //<-- Value is NULL
validatorP.Type =
ValidationDataType.Double;
validatorP.Display =
ValidatorDisplay.Dynamic;
validatorP.ErrorMessage =
"<br/>% must be between 0 and 100.";
validatorP.MinimumValue =
"0";
validatorP.MaximumValue =
"100";
cellP.Controls.Add(validatorP);
}
Why is the TextBoxControl.ID null ?
Seems to work with other type fields (i.e RadDatePicker.ID)
Thanks
protectedvoidpartnerGrid_ItemCreated(objectsender, GridItemEventArgs e){if(e.ItemisGridPagerItem){RadComboBox pageSize = (RadComboBox)e.Item.FindControl("PageSizeComboBox");RadComboBoxItem rcbItem100 = pageSize.FindItemByText("100");RadComboBoxItem rcbItem200 = pageSize.FindItemByText("200");if(rcbItem100 ==null){pageSize.Items.Add(newRadComboBoxItem("100"));pageSize.FindItemByText("100").Attributes.Add("ownerTableViewId", partnerGrid.MasterTableView.ClientID);}if(rcbItem200 ==null){pageSize.Items.Add(newRadComboBoxItem("200"));pageSize.FindItemByText("200").Attributes.Add("ownerTableViewId", partnerGrid.MasterTableView.ClientID);}pageSize.SelectedValue = partnerGrid.PageSize.ToString();}}
Inexplicably, ItemCreated is fired four times when the pagesize is changed. I suppose two are for each pager (even though
it's set to top-only, the bottom pager is still there), but I can't fathom the last two.
Worse, on the 3rd and 4th invocations of ItemCreated, the combobox has remembered the standard three (10, 20, 50) plus whatever
was selected, but has lost the unselected one. So, if the user goes directly to 200, when the grid re-renders
it shows 100 below 200 (as it was added but 200 was already there).
Secondly, on subsequent postbacks, the combobox will not accept a selectedValue of whatever the fifth item is now
and keeps defaulting to 10. The grid's page size is fine, so the query gets the appropriate number of items,
we just show 10 in the pulldown instead of the number they actually chose.
The ajax is really simple:<telerik:AjaxSettingAjaxControlID="partnerGrid"><UpdatedControls><telerik:AjaxUpdatedControlControlID="partnerGrid"LoadingPanelID="gridLoadingPanel"/></UpdatedControls></telerik:AjaxSetting>
Anytime we do something in the grid, show the loading panel while we're thinking about it. It seems as if
something's wrong in ajax land, but it can't be simpler than that.
<telerik:RadOrgChart ID="OrgChart" runat="server" DataFieldID="ID" DataFieldParentID="ParentID" Enabled="true" Width="100%">
<RenderedFields>
<ItemFields>
<telerik:OrgChartRenderedField DataField="BusinessTitle" />
<telerik:OrgChartRenderedField DataField="EmployeeName" />
</ItemFields>
</RenderedFields>
</telerik:RadOrgChart>
<telerik:RadComboBox ID="RadComboBox1" runat="server" Width="130px"> <Items> <telerik:RadComboBoxItem runat="server" Text="Right Chest" Value="Right Chest" /> <telerik:RadComboBoxItem runat="server" Text="Left Chest" Value="Left Chest" /> <telerik:RadComboBoxItem runat="server" Text="On Pocket" Value="On Pocket" /> <telerik:RadComboBoxItem runat="server" Text="Full Front - Centered" Value="Full Front - Centered" /> <telerik:RadComboBoxItem runat="server" Text="Front Location - Other" Value="Front Location - Other" /> </Items> </telerik:RadComboBox>