[CLOSED] Coolite.Utilities Assembly ?

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Coolite.Utilities Assembly ?

    Hello,

    Curious what changes in the last check in for Coolite.Utilities assembly? Currently not working with other 3rd party controls.

    I've noticed in a few places in the Coolite project, you do a condition check to see if its a Ext control using the following:

    if (control != System.Web.UI.WebControl) { ... }
    Here is the exception I'm getting:
    [InvalidCastException: Unable to cast object of type 'Telerik.Web.UI.GridTableRow' to type 'Telerik.Web.UI.GridItem'.]
       Telerik.Web.UI.GridTableRow.get_ClientID() +86
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +185
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +251
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +251
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +251
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +251
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +251
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +251
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +251
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +251
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +251
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +251
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +251
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +251
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +251
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +251
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +251
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +251
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +251
       Coolite.Utilities.ControlUtils.FindControlByTypeName(Control seed, String typeFullName, Boolean shallow, Boolean traverse, Control branch) +423
       Coolite.Utilities.ControlUtils.FindControl(Control seed, Type type, Boolean shallow) +55
       Coolite.Utilities.ControlUtils.FindControl(Control seed, Type type) +32
       Coolite.Ext.Web.ScriptManager.get_ScriptContainer() +61
       Coolite.Ext.Web.ScriptManager.Page_PreRenderComplete(Object sender, EventArgs e) +89
       System.EventHandler.Invoke(Object sender, EventArgs e) +0
       System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +2063008
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2247
    Timothy
  2. #2

    RE: [CLOSED] Coolite.Utilities Assembly ?

    Hi Timothy,

    Can you explain the scenario in more detail? Are you calling into the Coolite.Utilities assembly, or is that stack-trace/exception just being thown by the Toolkit? Can you post a simplified code sample?


    Geoffrey McGill
    Founder & CEO
  3. #3

    RE: [CLOSED] Coolite.Utilities Assembly ?

    I'm not calling it directly, the stack shows the function is being called internally. I just have a Telerik control inside a Ext:TabPanel.

    Would you be willing to expose the Coolite.Utilities code and I can debug?

    Cheers,
    Timothy
  4. #4

    RE: [CLOSED] Coolite.Utilities Assembly ?

    Hmm, I didn't think I would be able to pull an example off so easily:

    Example.aspx:
    <%@ Page Language="C#" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            dgWord.Rebind();
        }
    
        protected void dgWord_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            dgWord.DataSource = new object[] { "Word", "Word" };
        }
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <p><a href="Example.aspx">Reload</a></p>
        <form id="form1" runat="server">
            <asp:ScriptManager runat="server" EnablePartialRendering="True" />
            <ext:ScriptManager runat="server" Theme="Gray" />
    
            <ext:TabPanel ID="TabPanel1" runat="server" ActiveTabIndex="0" AutoPostBack="True" AutoHeight="True" AutoWidth="True" DeferredRender="True">
                <Tabs>
                    <ext:Tab ID="Tab1" runat="server" Title="Tab 1">
                        <Content>
                            Content 1
                        </Content>
                    </ext:Tab>
                    <ext:Tab ID="Tab2" runat="server" Title="Tab 2">
                        <Content>
                            <Telerik:RadGrid ID="dgWord" runat="server" OnNeedDataSource="dgWord_NeedDataSource" AutoGenerateColumns="False" SkinID="Default" Width="800">
                                <MasterTableView runat="server" AllowNaturalSort="True" AllowPaging="True" AllowSorting="True" CommandItemDisplay="Bottom" PageSize="10" TableLayout="Fixed">
                                    <CommandItemStyle HorizontalAlign="Right" />
                                    <CommandItemTemplate>
                                        <ExtJS:Button ID="btnAdd" runat="server" Text="Add" MinWidth="60" StyleSpec="margin: 5px; width: 60px;" />
                                    </CommandItemTemplate>
                                    <Columns>
                                        <Telerik:GridTemplateColumn>
                                            <ItemTemplate>
                                                Word
                                            </ItemTemplate>
                                        </Telerik:GridTemplateColumn>
                                    </Columns>
                                    <NoRecordsTemplate>
                                        Nadda
                                    </NoRecordsTemplate>
                                </MasterTableView>
                                <PagerStyle AlwaysVisible="True" Mode="NextPrev" Width="100%" />
                            </Telerik:RadGrid>
                        </Content>
                    </ext:Tab>
                </Tabs>
            </ext:TabPanel>
    
        </form>
    </body>
    </html>
    Exception:
    [InvalidCastException: Unable to cast object of type 'Telerik.Web.UI.GridTableRow' to type 'Telerik.Web.UI.GridItem'.]
       Telerik.Web.UI.GridTableRow.get_ClientID() +86
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +185
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +251
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +251
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +251
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +251
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +251
       Coolite.Utilities.ControlUtils.FindChildControl(Control seed, String typeFullName, Boolean shallow) +251
       Coolite.Utilities.ControlUtils.FindControlByTypeName(Control seed, String typeFullName, Boolean shallow, Boolean traverse, Control branch) +423
       Coolite.Utilities.ControlUtils.FindControl(Control seed, Type type, Boolean shallow) +55
       Coolite.Utilities.ControlUtils.FindControl(Control seed, Type type) +32
       Coolite.Ext.Web.ScriptManager.get_ScriptContainer() +61
       Coolite.Ext.Web.ScriptManager.Page_PreRenderComplete(Object sender, EventArgs e) +89
       System.EventHandler.Invoke(Object sender, EventArgs e) +0
       System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +2063008
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2247
    Cheers,
    Timothy
  5. #5

    RE: [CLOSED] Coolite.Utilities Assembly ?

    Wow, also happens when its the only control on the page ;)

    Example.aspx:
    <%@ Page Language="C#" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            dgWord.Rebind();
        }
    
        protected void dgWord_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            dgWord.DataSource = new object[] { "Word", "Word" };
        }
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <p><a href="Example.aspx">Reload</a></p>
        <form id="form1" runat="server">
            <asp:ScriptManager runat="server" EnablePartialRendering="True" />
            <ext:ScriptManager runat="server" Theme="Gray" />
    
    
                            <Telerik:RadGrid ID="dgWord" runat="server" OnNeedDataSource="dgWord_NeedDataSource" AutoGenerateColumns="False" SkinID="Default" Width="800">
                                <MasterTableView runat="server" AllowNaturalSort="True" AllowPaging="True" AllowSorting="True" CommandItemDisplay="Bottom" PageSize="10" TableLayout="Fixed">
                                    <CommandItemStyle HorizontalAlign="Right" />
                                    <CommandItemTemplate>
                                        <ExtJS:Button ID="btnAdd" runat="server" Text="Add" MinWidth="60" StyleSpec="margin: 5px; width: 60px;" />
                                    </CommandItemTemplate>
                                    <Columns>
                                        <Telerik:GridTemplateColumn>
                                            <ItemTemplate>
                                                Word
                                            </ItemTemplate>
                                        </Telerik:GridTemplateColumn>
                                    </Columns>
                                    <NoRecordsTemplate>
                                        Nadda
                                    </NoRecordsTemplate>
                                </MasterTableView>
                                <PagerStyle AlwaysVisible="True" Mode="NextPrev" Width="100%" />
                            </Telerik:RadGrid>
    
    
        </form>
    </body>
    </html>
  6. #6

    RE: [CLOSED] Coolite.Utilities Assembly ?

    Just wanted to throw this in; this didn't happen as of revision 348 to \Coolite.Ext.Web\Build\Resources\ReferenceAssembli es\Coolite.Utilities\Coolite.Utilities.dll but was introduced on 351 :)

    Hope that helps narrow it down for you!

    Cheers,
    Timothy
  7. #7

    RE: [CLOSED] Coolite.Utilities Assembly ?

    I added the Coolite.Utilities Project to the main .sln. 

    I ran a couple tests using other 3rd party controls within your sample (not Telerik) and did not run into the Exception. I stepped through the code and it appears to be correct, but who know's what might be triggering the error. There must be something obvious in there that I'm missing. 


    Do an SVN update and retry with the new Utilties assembly. If the exception is thrown, please set a breakpoint on ControlUtils.cs FindChildControl(Control seed, string typeFullName, bool shallow) approx line #210. Step through the code and let me know if you hit the error.


    The Coolite.Utilities project is generic and can be used with any control/library. There's no requirement to Reference or only use with Coolite/Ext controls. 


    Geoffrey McGill
    Founder & CEO
  8. #8

    RE: [CLOSED] Coolite.Utilities Assembly ?

    Thanks, will let you know.

    Cheers,
    Timothy
  9. #9

    RE: [CLOSED] Coolite.Utilities Assembly ?

    OK, I debugged it and I've come to the following conclusion:

    What is the purpose of:

    tempClientID = control.ClientID ?? "";
    On line 222 in ControlUtils.cs?

    The variable is not used and is the culprit for throwing the exception.

    Cheers,
    Timothy

  10. #10

    RE: [CLOSED] Coolite.Utilities Assembly ?

    ok, delete that line and see what happens. It's not required, but I'm at a loss to explain why any Control would fail on that line. Maybe Telerik has overridden the .ClientID property within their controls and is performing some kind of type check internally which is throwing the Exception. There's really no reason calling .ClientID should throw that kind of Exception... but, I always reserve the right to change my mind. ;)

    Can you use Reflector to figure out if they're messing around with the .ClientID property of GridTableRow or GridItem class?


    Geoffrey McGill
    Founder & CEO
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 3
    Last Post: Apr 09, 2012, 1:01 PM
  2. [CLOSED] Could not load file or assembly Coolite.Ext.Web
    By Satyanarayana murthy in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: May 05, 2010, 1:12 AM
  3. Could not load file or assembly Coolite.Ext.Web
    By ranganath in forum 1.x Help
    Replies: 0
    Last Post: May 04, 2010, 9:11 AM
  4. Custom Build of Coolite Assembly
    By amitpareek in forum Feature Requests
    Replies: 1
    Last Post: Nov 04, 2008, 9:51 AM
  5. Replies: 3
    Last Post: Sep 19, 2008, 6:12 PM

Posting Permissions