RadColorPicker goes empty if validation (CustomValidator) fails

3 posts, 0 answers
  1. Konstantin Isaev
    Konstantin Isaev avatar
    5 posts
    Member since:
    Nov 2009

    Posted 11 Jan 2012 Link to this post

    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. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 16 Jan 2012 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Konstantin Isaev
    Konstantin Isaev avatar
    5 posts
    Member since:
    Nov 2009

    Posted 16 Jan 2012 Link to this post

    Sorry for spent time.
    Issue actually was in my code.
    Thanks for attention.
Back to Top