This is a migrated thread and some comments may be shown as answers.

RadColorPicker goes empty if validation (CustomValidator) fails

2 Answers 71 Views
ColorPicker
This is a migrated thread and some comments may be shown as answers.
Konstantin Isaev
Top achievements
Rank 1
Konstantin Isaev asked on 11 Jan 2012, 07:59 PM
Hi!
I have the foloowing issue:
RadColorPicker can't load its client state (NullReferenceException) if CustomValidator validation fails.
Markup:
<Telerik:RadGrid runat="server" ID="statusesGrid" OnNeedDataSource="NeedStatusesDataSource"
OnDeleteCommand="HandleDelete" OnInsertCommand="HandleInsert" OnUpdateCommand="HandleUpdate"
OnItemCommand="HandleMakeDefault"
AutoGenerateColumns="false" Width="100%">
    <MasterTableView Name="StatusesGrid" EditMode="InPlace" CommandItemDisplay="Top"
        DataKeyNames="UnitTypeStatusId" ClientDataKeyNames="UnitTypeStatusId"
    >
        <CommandItemSettings ShowAddNewRecordButton="true" AddNewRecordText="Add new status" ShowRefreshButton="false" />
        <Columns>
            <Telerik:GridEditCommandColumn UniqueName="Edit" UpdateText="Save" InsertText="Save" CancelText="Cancel" ButtonType="LinkButton" />
            <Telerik:GridBoundColumn DataField="UnitTypeStatusId" UniqueName="UnitTypeStatusId" Display="false" />
            <Telerik:GridTemplateColumn UniqueName="NameWithValidator" DataField="UnitTypeStatusName" HeaderText="Name">
                <InsertItemTemplate>
                    <Telerik:RadTextBox runat="server" ID="newNameBox" Text='<%# Bind("UnitTypeStatusName") %>' />
                    <DL:UnitTypeStatusNameValidator runat="server" ID="nameVaidator" ForeColor="Red" UnitTypeIsCurrentObject="true" ThisStatusID="0"
                        ControlToValidate="newNameBox" ValidateEmptyText="true" Display="Static"  />
                </InsertItemTemplate>
                <EditItemTemplate>
                    <Telerik:RadTextBox runat="server" ID="nameEditBox" Text='<%# Bind("UnitTypeStatusName") %>' />
                    <DL:UnitTypeStatusNameValidator runat="server" ID="nameVaidator" ForeColor="Red" UnitTypeIsCurrentObject="true" ThisStatusID='<%# Bind("UnitTypeStatusID") %>'
                        ControlToValidate="nameEditBox" ValidateEmptyText="true" Display="Static"  />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Literal runat="server" Mode="Encode" Text='<%# Eval("UnitTypeStatusName") %>' />
                </ItemTemplate>
            </Telerik:GridTemplateColumn>
            <Telerik:GridTemplateColumn DataField="UnitTypeStatusColor" UniqueName="UnitTypeStatusColor" HeaderText="Color">
                <ItemTemplate>
                    <DL:ColorValueDisplay runat="server" Value='<%# Eval("StatusColor") %>' />
                </ItemTemplate>
                <EditItemTemplate>
                    <DL:ColorValueEditor runat="server" ID="colPicker" HtmlColor='<%# Bind("UnitTypeStatusColor") %>' />
                </EditItemTemplate>
                <InsertItemTemplate>
                    <DL:ColorValueEditor runat="server" ID="colPicker" HtmlColor='<%# Bind("UnitTypeStatusColor") %>' />
                </InsertItemTemplate>
            </Telerik:GridTemplateColumn>
            <Telerik:GridCheckBoxColumn UniqueName="AllowUnitReshedule" DataField="AllowUnitReshedule" DataType="System.Boolean"
                HeaderText="Moveable" />
            <Telerik:GridButtonColumn ButtonType="LinkButton" Text="Make default" UniqueName="MakeDefault" CommandName="MakeDefault" HeaderText="" />
            <Telerik:GridCheckBoxColumn DataField="DefaultStatus" UniqueName="DefaultStatus" HeaderText="Default" ReadOnly="true" />
            <Telerik:GridTemplateColumn UniqueName="Delete" HeaderText="">
                <ItemTemplate>
                    <asp:MultiView runat="server" ID="view" ActiveViewIndex="<%# GetViewIndexByDeletability(Container.DataItem) %>">
                        <asp:View runat="server" ID="nonDelete">
                            <span title="This status can't be deleted">Protected</span>
                        </asp:View>
                        <asp:View runat="server" ID="delete">
                            <a href='javascript:OpenDeleteDialogForUnitTypeStatus(<%# Eval("UnitTypeStatusId") %>)'>Delete</a>
                        </asp:View>
                    </asp:MultiView>
                </ItemTemplate>
                <EditItemTemplate>
                    <!-- -->
                </EditItemTemplate>
                <InsertItemTemplate>
                    <!-- -->
                </InsertItemTemplate>
            </Telerik:GridTemplateColumn>
        </Columns>
        <NoRecordsTemplate>
            No statuses defined for this unit type
        </NoRecordsTemplate>
    </MasterTableView>
 
</Telerik:RadGrid>
All this markup is in RadAjaxPanel.
The bug happens if CustomVaidator's check fails duirng item Insertion. During Item Editing it all works well.
A null reference exception happens when this bug taking place. Stack trace is below:
at Telerik.Web.UI.RadColorPicker.LoadClientState(Dictionary`2 clientState)
Thanks for your attention.



2 Answers, 1 is accepted

Sort by
0
Slav
Telerik team
answered on 16 Jan 2012, 03:55 PM
Hello Konstantin,

Such problem with the RadColorPicker hasn't been reported so far and I am unable to reproduce your scenario accurately based on the provided sample. Also, I am unaware of your exact implementation as the controls that you mentioned are not located in the presented code.

Note that I am willing to help, but I need to reproduce the problem in order to be able to suggest a proper solution. Please try to prepare and send a simple, fully runnable page that isolates the issue so that we can inspect it locally. If this isn't possible, you could also describe in details your setup and provide reliable steps to recreate the problem at hand.

Greetings,
Slav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Konstantin Isaev
Top achievements
Rank 1
answered on 16 Jan 2012, 04:59 PM
Sorry for spent time.
Issue actually was in my code.
Thanks for attention.
Tags
ColorPicker
Asked by
Konstantin Isaev
Top achievements
Rank 1
Answers by
Slav
Telerik team
Konstantin Isaev
Top achievements
Rank 1
Share this question
or