Filtering error with Grid

22 posts, 0 answers
  1. Todd
    Todd avatar
    24 posts
    Member since:
    Sep 2007

    Posted 07 Oct 2008 Link to this post

    I am attempting to filter on a column in a simple grid i created but I get the following error:
    Unable to cast object of type 'ASP.ui_navs_mainlayout_master' to type 'Telerik.Web.UI.GridTableView'

    Am I missing something from my .NET application?
  2. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 07 Oct 2008 Link to this post

    It looks like you may be trying to access the Grid's MasterTableView inaccurately in your code. Can you post the relevant snippets of any code that you're using with your RadGrid? With that info, I think this problem will be easy to solve.

    -Todd
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Todd
    Todd avatar
    24 posts
    Member since:
    Sep 2007

    Posted 07 Oct 2008 Link to this post

    I read something that you can't use DataBind if you are using filtering...is that true?
    Here is my code:

     

    <telerik:RadGrid ID="GridView1" runat="server"

     

     

    AllowFilteringByColumn="True" AllowSorting="True"

     

     

    GridLines="None" Skin="WebBlue">

     

     

    <MasterTableView>

     

     

    <ExpandCollapseColumn>

     

     

    <HeaderStyle Width="20px" />

     

     

    </ExpandCollapseColumn>

     

     

    <RowIndicatorColumn>

     

     

    <HeaderStyle Width="20px" />

     

     

    </RowIndicatorColumn>

     

     

    </MasterTableView>

     

     

    <FilterMenu EnableTheming="True">

     

     

    <CollapseAnimation Duration="200" Type="OutQuint" />

     

     

    </FilterMenu>

     

     

    </telerik:RadGrid><br />

    Code Behind:

     

     

    Sub FillGrid()

     

     

    Dim cmd As OleDbCommand = New OleDbCommand

     

     

    Dim dReader As System.Data.OleDb.OleDbDataReader

     

    oConn.Open()

    cmd.Connection = oConn

    cmd.CommandText =

    " select /*+ all_rows */ rownum, defect_num, program_desc, change_reason, change_desc, close_date " & _

     

     

    " from hw_ir_productivity t " & _

     

     

    " where program_desc in ('" & leftSideMenu.GetProjects.Replace(",", "','") & "') " & _

     

     

    " and to_date(close_date,'mm/dd/yyyy') >= to_date('" & HttpContext.Current.Session("varStartDate") & "','mm/dd/yyyy') " & _

     

     

    " and to_date(close_date,'mm/dd/yyyy') <= to_date('" & HttpContext.Current.Session("varEndDate") & "','mm/dd/yyyy') "

     

     

     

    dReader = cmd.ExecuteReader()

    GridView1.DataSource = dReader

    GridView1.DataBind()

    dReader.Close()

    oConn.Close()

     

    End Sub

     

  5. Todd
    Todd avatar
    24 posts
    Member since:
    Sep 2007

    Posted 07 Oct 2008 Link to this post

    I also just tried removing the DataBind and doing something similar to this
    http://www.telerik.com/help/aspnet-ajax/grdbindingtodatareader.html

    but I get the same error.
  6. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 07 Oct 2008 Link to this post

    No, but I am curious where you're calling FillGrid from. If you are manually binding your grid, you should probably use the NeedDataSource event to support operations like paging, sorting, and filtering. See this demo for a complete explanation of the event and an example of how that event works:


    Also, on a side note, I'd highly encourage you to change your SQL from using string concatentation to using strongly typed parameters. This will significantly improve the security of your application and leave you less vulnerable to SQL injection attacks. Here's an example of that approach if you need it:

    OleDbCommand SelectCommand = new OleDbCommand("SELECT ID, Name, Email FROM Customers WHERE (ID = ?) AND (Name = ?)",this.oleDbConnection1); 
     
    SelectCommand.Parameters.Add(new System.Data.OleDb.OleDbParameter("ID", System.Data.OleDb.OleDbType.Integer)); 
     
    SelectCommand.Parameters.Add(new System.Data.OleDb.OleDbParameter("Name", System.Data.OleDb.OleDbType.VarChar)); 

    Hope that helps.

    -Todd
  7. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 07 Oct 2008 Link to this post

    What's odd about your error is that it looks like your page is trying to cast a reference to the ASP.NET generated class for your masterpage to the type "Telerik.Web.UI.GridTableView." Are you sure there is no other code in you code behind that could be contributing to this? Is the class reference in your @Page registration correct?

    Try using the "Format Code" toolbar button in the forums to post the complete code for your APSX and code behind. That will help me see what could be causing this strange error outside of the grid.

    -Todd
  8. Todd
    Todd avatar
    24 posts
    Member since:
    Sep 2007

    Posted 07 Oct 2008 Link to this post

    <%@ Page Language="vb" MasterPageFile="~/UI/Navs/MainLayout.Master" AutoEventWireup="false" CodeBehind="HWIRProductivity.aspx.vb" Inherits="EngineeringPerformance.HWIRProductivity" %> 
     
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
     
    <%@ Register Assembly="RadAjax.Net2" Namespace="Telerik.WebControls" TagPrefix="radA" %> 
     
    <%@ Register Assembly="NetChartsServer, Version=5.0.0.1, Culture=neutral, PublicKeyToken=77ebbf14efdf8df0" 
        Namespace="NetChartsServer" TagPrefix="ns" %> 
     
    <%@ Register Assembly="RadTreeView.Net2" Namespace="Telerik.WebControls" TagPrefix="radT" %> 
    <%@ Register Assembly="RadTabStrip.Net2" Namespace="Telerik.WebControls" TagPrefix="radTS" %> 
     
    <%@ Register Assembly="RadGrid.Net2" Namespace="Telerik.WebControls" TagPrefix="radG" %> 
     
    <%@ Register Src="Navs/HWTabsBSP.ascx" TagName="HWTabsBSP" TagPrefix="uc2" %> 
     
    <%@ Register Src="Navs/HWProductivityMenu.ascx" TagName="HWProductivityMenu" TagPrefix="uc1" %> 
     
     
       <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">  
              
                <uc1:HWProductivityMenu ID="HWProductivityMenu1" runat="server" /> 
     
                    <!-- Page Title Start --> 
                    <div id="headers"><IMG id="red_square" alt="Red Square" src="../../images/redsquare.gif">  
                        <div id="sectionHeader">HW</div> 
                        <asp:label id="ErrorMsg" runat="server" BackColor="Transparent" Font-Size="10pt" Font-Bold="True" 
                            ForeColor="DarkRed"></asp:label> 
                    </div> 
                    <!-- Page Title End --> 
                      
                    <!-- Column Two Start --> 
                    <div class="column-2a-wrapper">  
                        <div class="column-2a">  
     
                            <uc2:HWTabsBSP ID="HWTabsBSP1" runat="server" /> 
                            <div class="content">  
                                <table id='mainTable' height=380><tr><td valign=top class="hlt1">  
                                    <asp:literal id="litLoadDate" runat="server" Text="" EnableViewState="True" Visible="true"></asp:literal> 
                                    <br /> 
                                    <asp:Label id="lblNWAHours" runat="server" Font-Bold="True" Font-Size="12pt" Font-Names="Arial" 
                                        ForeColor="Black"></asp:Label><br /> 
                                    <radG:RadGrid ID="rgNWAHours2" runat="server" ShowHeader="False" Skin="3D" Visible="False">  
                                        <MasterTableView> 
                                            <ExpandCollapseColumn Resizable="False" Visible="False">  
                                                <HeaderStyle Width="20px" /> 
                                            </ExpandCollapseColumn> 
                                            <RowIndicatorColumn Visible="False">  
                                                <HeaderStyle Width="20px" /> 
                                            </RowIndicatorColumn> 
                                        </MasterTableView> 
                                        <AlternatingItemStyle BackColor="White" BorderColor="White" BorderStyle="Solid" BorderWidth="2px" /> 
                                    </radG:RadGrid><br /> 
                                    <telerik:RadGrid ID="rgNWAHours" runat="server" ShowHeader="False" Skin="WebBlue">  
                                        <MasterTableView> 
                                            <ExpandCollapseColumn> 
                                                <HeaderStyle Width="20px" /> 
                                            </ExpandCollapseColumn> 
                                            <RowIndicatorColumn> 
                                                <HeaderStyle Width="20px" /> 
                                            </RowIndicatorColumn> 
                                        </MasterTableView> 
                                        <FilterMenu EnableTheming="True">  
                                            <CollapseAnimation Duration="200" Type="OutQuint" /> 
                                        </FilterMenu> 
                                    </telerik:RadGrid><br /> 
                                    <asp:Label ID="lblIRProd" runat="server" Font-Bold="True" Font-Names="Arial" Font-Size="12pt" 
                                        ForeColor="Black"></asp:Label>&nbsp;<br /> 
                                    <radG:RadGrid ID="GridView12" runat="server" GridLines="None" Skin="3D" AllowSorting="True" AllowFilteringByColumn="True" Visible="False">  
                                        <MasterTableView> 
                                            <ExpandCollapseColumn Resizable="False" Visible="False">  
                                                <HeaderStyle Width="20px" /> 
                                            </ExpandCollapseColumn> 
                                            <RowIndicatorColumn Visible="False">  
                                                <HeaderStyle Width="20px" /> 
                                            </RowIndicatorColumn> 
                                            <CommandItemSettings AddNewRecordImageUrl="D:\Program Files\Telerik\RadControls for ASP.NET Q2 2007\NET2\RadControls\Grid\Skins\Glassy\AddRecord.gif" 
                                                RefreshImageUrl="D:\Program Files\Telerik\RadControls for ASP.NET Q2 2007\NET2\RadControls\Grid\Skins\Glassy\Refresh.gif" /> 
                                            <EditFormSettings> 
                                                <EditColumn CancelImageUrl="D:\Program Files\Telerik\RadControls for ASP.NET Q2 2007\NET2\RadControls\Grid\Skins\Glassy\Cancel.gif" 
                                                    EditImageUrl="D:\Program Files\Telerik\RadControls for ASP.NET Q2 2007\NET2\RadControls\Grid\Skins\Glassy\Edit.gif" 
                                                    FilterImageUrl="D:\Program Files\Telerik\RadControls for ASP.NET Q2 2007\NET2\RadControls\Grid\Skins\Glassy\Filter.gif" 
                                                    InsertImageUrl="D:\Program Files\Telerik\RadControls for ASP.NET Q2 2007\NET2\RadControls\Grid\Skins\Glassy\Insert.gif" 
                                                    SortAscImageUrl="D:\Program Files\Telerik\RadControls for ASP.NET Q2 2007\NET2\RadControls\Grid\Skins\Glassy\SortAsc.gif" 
                                                    SortDescImageUrl="D:\Program Files\Telerik\RadControls for ASP.NET Q2 2007\NET2\RadControls\Grid\Skins\Glassy\SortDesc.gif" 
                                                    UpdateImageUrl="D:\Program Files\Telerik\RadControls for ASP.NET Q2 2007\NET2\RadControls\Grid\Skins\Glassy\Update.gif">  
                                                </EditColumn> 
                                            </EditFormSettings> 
                                        </MasterTableView> 
                                        <FilterMenu TextColumnBackColor="WindowFrame"></FilterMenu> 
                                    </radG:RadGrid><br /> 
                                    <telerik:RadGrid ID="GridView1" runat="server"   
                                        OnNeedDataSource="GridView1_NeedDataSource" 
                                        OnDataBound="GridView1_DataBound" 
                                        AllowFilteringByColumn="True" AllowSorting="True" 
                                        GridLines="None" Skin="WebBlue">  
                                        <MasterTableView> 
                                            <ExpandCollapseColumn> 
                                                <HeaderStyle Width="20px" /> 
                                            </ExpandCollapseColumn> 
                                            <RowIndicatorColumn> 
                                                <HeaderStyle Width="20px" /> 
                                            </RowIndicatorColumn> 
                                        </MasterTableView> 
                                        <FilterMenu EnableTheming="True">  
                                            <CollapseAnimation Duration="200" Type="OutQuint" /> 
                                        </FilterMenu> 
                                    </telerik:RadGrid><br /> 
                                      
                                    <asp:literal id="litProject" runat="server" Text="" EnableViewState="True" Visible="true"></asp:literal><br>  
                                      
                                </td></tr></table> 
                            </div> 
                        </div> 
                    </div> 
                    <!-- Column Two End --> 
        </asp:Content> 
     
     
  9. Todd
    Todd avatar
    24 posts
    Member since:
    Sep 2007

    Posted 07 Oct 2008 Link to this post

    Imports System.Text  
    Imports System.IO  
    Imports System.data.OleDb  
    Imports NetChartsServer.ServerGeneratedImage  
     
    Partial Public Class HWIRProductivity  
        Inherits EngineeringPerformance.HW  
     
        Public WithEvents HWProductivityMenu As System.Web.UI.UserControl  
     
        Dim oConn As New OleDbConnection(ConfigurationSettings.AppSettings("MenuConnectString"))  
        'i counter  
        Dim i As Integer  
        Dim buildHash As New HWStoreHash  
        Dim fill As New HWFillObjects  
        ' get a reference to the MyUserControl user control.  
        Dim leftSideMenu As HWProductivityMenu  
        Dim reader As OleDbDataReader = Nothing 
     
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load  
     
            Dim plContentPlaceHolder As ContentPlaceHolder  
     
            plContentPlaceHolder = CType(Master.FindControl("ContentPlaceHolder1"), ContentPlaceHolder)  
     
            If Not plContentPlaceHolder Is Nothing Then  
                leftSideMenu = CType(plContentPlaceHolder.FindControl("HWProductivityMenu1"), HWProductivityMenu)  
            End If  
     
            ErrorMsg.Text = leftSideMenu.ErrorMessage  
     
            litLoadDate.Text = "Load Date: " & Session("LoadDate")  
     
            'On PostBack  
            If IsPostBack() Then  
            Else 'Not PostBack  
     
                leftSideMenu.FillGroupListBox()  
                leftSideMenu.SelectGroup(0)  
     
                HttpContext.Current.Session("SelectedNWAGroup") = leftSideMenu.Group  
     
                ErrorMsg.Text = leftSideMenu.ErrorMessage  
     
                'Set From/To Date Range  
                leftSideMenu.StartDate = "01/01/2000" 
                leftSideMenu.EndDate = Format$(Now, "MM/dd/yyyy") 'Current Date  
                'Copy From/To Dates to Sessions  
                Session("varStartDate") = leftSideMenu.StartDate  
                Session("varEndDate") = leftSideMenu.EndDate  
     
            End If  
     
        End Sub  
     
     
        Private Sub HWIRProductivity_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender  
            lblNWAHours.Text = "HW NWA Hours Table over Fiscal 12 Months" 
            lblIRProd.Text = "HW IR Productivity Table " & HttpContext.Current.Session("varStartDate") & " - " & HttpContext.Current.Session("varEndDate")  
     
            leftSideMenu.StartDate = HttpContext.Current.Session("varStartDate")  
            leftSideMenu.EndDate = HttpContext.Current.Session("varEndDate")  
            If leftSideMenu.GetProjects.Length = 0 Then  
                litProject.Text = "Project(s): " 
            Else  
                litProject.Text = "Project(s): " & leftSideMenu.GetProjects.Substring(0, leftSideMenu.GetProjects.Length - 1)  
            End If  
     
            FillNWAHoursGrid()  
            'Fill the data grid with IR Productivity Data  
            'FillGrid()  
     
        End Sub  
     
     
        '******************************************************************************************  
        ' Fill the NWA Hours Data Grid with Total Hours for NWAs based off of the Projects pick list and  
        ' the Start and End Date text fields  
        '******************************************************************************************  
        Sub FillNWAHoursGrid()  
            Dim cmd As OleDbCommand = New OleDbCommand  
            Dim dReader As System.Data.OleDb.OleDbDataReader  
            oConn.Open()  
     
            cmd.Connection = oConn 
            cmd.CommandText = " select * " & _  
                " from TABLE(NWAHours('" & leftSideMenu.Group & "', 'HW')) "  
     
            dReader = cmd.ExecuteReader()  
            Me.rgNWAHours.DataSource = dReader 
            Me.rgNWAHours.DataBind()  
            dReader.Close()  
     
            'Dim ds As New DataSet  
            'Dim SQL As String = " select * " & _  
            '    " from TABLE(NWAHours('" & leftSideMenu.Group & "', 'HW')) "  
            'Dim da As New OleDbDataAdapter(SQL, oConn)  
            'ds.Clear()  
            'da.Fill(ds)  
            'Me.rgNWAHours.DataSource = ds 
            'Me.rgNWAHours.DataBind()  
     
            oConn.Close()  
        End Sub  
     
     
        '******************************************************************************************  
        ' Fill the Data Grid with IR Productivity data based off of the Projects pick list and  
        ' the Start and End Date text fields  
        '******************************************************************************************  
        Sub FillGrid()  
            Dim cmd As OleDbCommand = New OleDbCommand  
            Dim dReader As System.Data.OleDb.OleDbDataReader  
            oConn.Open()  
     
            cmd.Connection = oConn 
            cmd.CommandText = " select /*+ all_rows */ rownum, defect_num, program_desc, change_reason, change_desc, close_date " & _  
            " from hw_ir_productivity t " & _  
            " where program_desc in ('" & leftSideMenu.GetProjects.Replace(",", "','") & "') " & _  
            " and to_date(close_date,'mm/dd/yyyy') >= to_date('" & HttpContext.Current.Session("varStartDate") & "','mm/dd/yyyy') " & _  
            " and to_date(close_date,'mm/dd/yyyy') <= to_date('" & HttpContext.Current.Session("varEndDate") & "','mm/dd/yyyy') "  
     
            dReader = cmd.ExecuteReader()  
            GridView1.DataSource = dReader 
            GridView1.DataBind()  
            dReader.Close()  
            oConn.Close()  
        End Sub  
     
        Protected Sub GridView1_NeedDataSource(ByVal [source] As Object, _  
        ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) _  
          Handles GridView1.NeedDataSource  
            Dim SQL As String = " select /*+ all_rows */ rownum, defect_num, program_desc, change_reason, change_desc, close_date " & _  
            " from hw_ir_productivity t " & _  
            " where program_desc in ('" & leftSideMenu.GetProjects.Replace(",", "','") & "') " & _  
            " and to_date(close_date,'mm/dd/yyyy') >= to_date('" & HttpContext.Current.Session("varStartDate") & "','mm/dd/yyyy') " & _  
            " and to_date(close_date,'mm/dd/yyyy') <= to_date('" & HttpContext.Current.Session("varEndDate") & "','mm/dd/yyyy') "  
     
            GridView1.DataSource = ReadRecords(SQL)  
        End Sub 'RadGrid1_NeedDataSource  
     
        Protected Function ReadRecords(ByVal query As String) As OleDbDataReader  
            oConn.Open()  
            Dim cmd As New OleDbCommand(query, oConn)  
            reader = cmd.ExecuteReader()  
            Return reader  
        End Function 'ReadRecords  
     
        Protected Sub GridView1_DataBound(ByVal sender As Object, _  
        ByVal e As System.EventArgs) _  
                           Handles GridView1.DataBound  
            reader.Close()  
            oConn.Close()  
        End Sub 'GridView1_DataBound   
     
        'Sub HashForNetCharts()  
        '    Dim hashTable As Hashtable = HWIRProductivityTable.Variables  
        '    If (hashTable Is Nothing) Then  
        '        hashTable = New Hashtable  
        '    End If  
        '    hashTable.Clear()  
        '    hashTable.Add("varProjects", HttpContext.Current.Session("SelectedProjects").Replace(",", "','"))  
        '    hashTable.Add("varStartDate", HttpContext.Current.Session("varStartDate"))  
        '    hashTable.Add("varEndDate", HttpContext.Current.Session("varEndDate"))  
        '    hashTable.Add("redraw", "true")  
        '    HWIRProductivityTable.Variables = hashTable 
        'End Sub  
     
    End Class 
  10. Todd
    Todd avatar
    24 posts
    Member since:
    Sep 2007

    Posted 07 Oct 2008 Link to this post

    As you can see in the code, I've made my old grids (from telerik for ASP.NET) invisible while I replace them with new grids from telerik for ASP.NET AJAX.
  11. Todd
    Todd avatar
    24 posts
    Member since:
    Sep 2007

    Posted 07 Oct 2008 Link to this post

    Hi, I followed your advice from the link and I still get the same error.

    My old grids that use RadGrid for ASP.NET worked fine (but slower of course).  The new ones are the same...just replacing the old ones.  Is there anything new in ASP.NET AJAX that might cause this error.  Like you said, looks like it has to do with the master page?
  12. Todd
    Todd avatar
    24 posts
    Member since:
    Sep 2007

    Posted 07 Oct 2008 Link to this post

    ok, I just tried a very simple example on a new aspx page and I get a very similar error when attempting to filter on a column:

    Unable to cast object of type 'Telerik.Web.UI.RadGrid' to type 'Telerik.Web.UI.GridTableView'.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidCastException: Unable to cast object of type 'Telerik.Web.UI.RadGrid' to type 'Telerik.Web.UI.GridTableView'.

    Here is my code:
    ASPX Page

     

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="EngineeringPerformance.WebForm1" %> 
     
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     
    <html xmlns="http://www.w3.org/1999/xhtml" > 
    <head runat="server">  
        <title>Untitled Page</title> 
    </head> 
    <body> 
        <form id="form1" runat="server">  
        <div> 
            <asp:ScriptManager ID="ScriptManager1" runat="server">  
            </asp:ScriptManager> 
            <telerik:RadGrid ID="GridView1" runat="server" AllowFilteringByColumn="True" AllowSorting="True" 
                GridLines="None" Skin="WebBlue">  
    <MasterTableView> 
    <ExpandCollapseColumn> 
    <HeaderStyle Width="20px"></HeaderStyle> 
    </ExpandCollapseColumn> 
     
    <RowIndicatorColumn> 
    <HeaderStyle Width="20px"></HeaderStyle> 
    </RowIndicatorColumn> 
    </MasterTableView> 
     
    <FilterMenu EnableTheming="True">  
    <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
    </FilterMenu> 
    </telerik:RadGrid> 
          
        </div> 
        </form> 
    </body> 
    </html> 
     

    Code Behind

     

    Imports System.data.OleDb  
    Imports Telerik.Web.UI  
     
    Partial Public Class WebForm1  
        Inherits System.Web.UI.Page  
     
        Dim oConn As New OleDbConnection(ConfigurationSettings.AppSettings("MenuConnectString"))  
     
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load  
     
        End Sub  
     
        Protected Sub GridView1_NeedDataSource(ByVal source As Object, ByVal e As GridNeedDataSourceEventArgs) Handles GridView1.NeedDataSource  
            Dim SQL As String = " select /*+ all_rows */ rownum, defect_num, program_desc, change_reason, change_desc, close_date " & _  
            " from hw_ir_productivity t "   
     
            GridView1.DataSource = GetDataTable(SQL)  
        End Sub  
     
        Public Function GetDataTable(ByVal query As String) As DataTable  
            Dim adapter As OleDbDataAdapter = New OleDbDataAdapter  
            adapter.SelectCommand = New OleDbCommand(query, oConn)  
            Dim table1 As New DataTable  
            oConn.Open()  
            Try  
                adapter.Fill(table1)  
            Finally  
                oConn.Close()  
            End Try  
            Return table1  
        End Function  
     
    End Class 

     

  13. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 07 Oct 2008 Link to this post

    It's starting to sound like you may have a web.config configuration error. I'd suggest you create a brand new project with Telerik's controls and then compare the web.config to your current web.config. You need to make sure the handlers for both ASP.NET AJAX and the RadControls are configured correctly.

    See this thread for some additional ideas from people who had a similar problem:

    -Todd
  14. Todd
    Todd avatar
    24 posts
    Member since:
    Sep 2007

    Posted 07 Oct 2008 Link to this post

    I created a new aspx page and dragged a grid from the toolbox to the aspx page, then copied changed from the new web.config to my projects web.config.  I still got that error.  I am using VS 2005, not 2008.  I had to install ajax extensions and alter the web.config at that point.  Maybe I missed something?  Can you send me an example of a valid web.config so I can determine what I may be missing?
  15. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 07 Oct 2008 Link to this post

    Take a look at the web.config that comes with the RadControls Live Demos, usually located at %Program Files%\telerik\RadControls for ASPNET AJAX Q2 2008\Live Demos. That should be a good reference.

    You can also review the "base" ASP.NET AJAX web.config at %Program Files%\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025.

    I'd suggest using a diff program to compare the web.configs. My favorite is Beyond Compare, but any differ will do. Hope this helps!

    -Todd
  16. Todd
    Todd avatar
    24 posts
    Member since:
    Sep 2007

    Posted 07 Oct 2008 Link to this post

    I tried adding all the info to my web.config from the "live demos" section but it created another error.

    I'm including my web.config.  Could you please take a look to see what I might be missing as I have already tried to replace most of this file without any luck.  Thanks.

    fyi - i replaced some of connection info due to privacy issues.
    <?xml version="1.0"?><configuration> 
     
     <appSettings> 
            <!-- PRODUCTION   
     <add key="serverName" value="prod" /> 
     <add key="serverPort" value="8001" /> 
     <add key="MenuConnectString" value="Provider=MSDAORA.1;User ID=present;Data Source=prod.WORLD;Password=pwd" /> 
     <add key="OracleConnectString" value="Data Source=prod.WORLD;User ID=present;Password=pwd"/>  
       --> 
     <!-- DEVELOPMENT --> 
       <add key="serverName" value="dev"/>  
       <add key="serverPort" value="8001"/>  
       <add key="MenuConnectString" value="Provider=MSDAORA.1;User ID=present;Data Source=dev.WORLD;Password=pwd"/>  
       <add key="OracleConnectString" value="Data Source=dev.WORLD;User ID=present;Password=pwd"/>  
     
     </appSettings> 
    <system.web> 
     
      <httpHandlers> 
          <remove verb="*" path="*.asmx"/>  
          <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>  
          <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>  
          <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>  
        </httpHandlers> 
     
        <httpModules> 
          <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>  
        </httpModules> 
     
        <!--  DYNAMIC DEBUG COMPILATION  
              Set compilation debug="true" to insert debugging symbols (.pdb information)  
              into the compiled page. Because this creates a larger file that executes  
              more slowly, you should set this value to true only when debugging and to  
              false at all other times. For more information, refer to the documentation about  
              debugging ASP.NET files.  
        --> 
     <compilation defaultLanguage="vb" debug="true">  
       <assemblies> 
         <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>  
         <add assembly="Telerik.Charting, Version=2.0.5.0, Culture=neutral, PublicKeyToken=D14F3DCC8E3E8763"/>  
         <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>  
         <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>  
         <add assembly="System.Drawing.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>  
         <add assembly="NetChartsServer, Version=5.0.0.1, Culture=neutral, PublicKeyToken=77EBBF14EFDF8DF0"/>  
       </assemblies> 
     </compilation> 
     
     <pages> 
       <controls> 
         <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>  
       </controls> 
       <namespaces> 
         <clear/> 
         <add namespace="System"/>  
         <add namespace="System.Collections"/>  
         <add namespace="System.Collections.Specialized"/>  
         <add namespace="System.Configuration"/>  
         <add namespace="System.Text"/>  
         <add namespace="System.Text.RegularExpressions"/>  
         <add namespace="System.Web"/>  
         <add namespace="System.Web.Caching"/>  
         <add namespace="System.Web.SessionState"/>  
         <add namespace="System.Web.Security"/>  
         <add namespace="System.Web.Profile"/>  
         <add namespace="System.Web.UI"/>  
         <add namespace="System.Web.UI.WebControls"/>  
         <add namespace="System.Web.UI.WebControls.WebParts"/>  
         <add namespace="System.Web.UI.HtmlControls"/>  
       </namespaces> 
     </pages> 
        
            <!--  CUSTOM ERROR MESSAGES  
              Set customErrors mode="On" or "RemoteOnly" to enable custom error messages, "Off" to disable.   
              Add <error> tags for each of the errors you want to handle.  
     
              "On" Always display custom (friendly) messages.  
              "Off" Always display detailed ASP.NET error information.  
              "RemoteOnly" Display custom (friendly) messages only to users not running   
               on the local Web server. This setting is recommended for security purposes, so   
               that you do not display application detail information to remote clients.  
        --> 
      <customErrors mode="RemoteOnly"/>  
     
            <!--  AUTHENTICATION   
              This section sets the authentication policies of the application. Possible modes are "Windows",   
              "Forms", "Passport" and "None"  
     
              "None" No authentication is performed.   
              "Windows" IIS performs authentication (Basic, Digest, or Integrated Windows) according to   
               its settings for the application. Anonymous access must be disabled in IIS.   
              "Forms" You provide a custom form (Web page) for users to enter their credentials, and then   
               you authenticate them in your application. A user credential token is stored in a cookie.  
              "Passport" Authentication is performed via a centralized authentication service provided  
               by Microsoft that offers a single logon and core profile services for member sites.  
        --> 
            <authentication mode="Windows"/>  
            <!--  AUTHORIZATION   
              This section sets the authorization policies of the application. You can allow or deny access  
              to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous   
              (unauthenticated) users.  
        --> 
            <authorization> 
                <allow users="*"/>  
                <!-- Allow all users --> 
                <!--  <allow     users="[comma separated list of users]" 
                                 roles="[comma separated list of roles]"/>  
                      <deny      users="[comma separated list of users]" 
                                 roles="[comma separated list of roles]"/>  
                --> 
            </authorization> 
            <!--  APPLICATION-LEVEL TRACE LOGGING  
              Application-level tracing enables trace log output for every page within an application.   
              Set trace enabled="true" to enable application trace logging.  If pageOutput="true", the  
              trace information will be displayed at the bottom of each page.  Otherwise, you can view the   
              application trace log by browsing the "trace.axd" page from your web application  
              root.   
        --> 
            <trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true"/>  
            <!--  SESSION STATE SETTINGS  
              By default ASP.NET uses cookies to identify which requests belong to a particular session.   
              If cookies are not available, a session can be tracked by adding a session identifier to the URL.   
              To disable cookies, set sessionState cookieless="true".  
        --> 
            <sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="120"/>  
            <!--  GLOBALIZATION  
              This section sets the globalization settings of the application.   
        --> 
            <globalization requestEncoding="utf-8" responseEncoding="utf-8"/>  
            <xhtmlConformance mode="Legacy"/></system.web> 
    </configuration> 

  17. Todd
    Todd avatar
    24 posts
    Member since:
    Sep 2007

    Posted 08 Oct 2008 Link to this post

    Still no luck.  I've tried numerous changes to my web.config file.  I am running VS 2005.  Would that be a problem?  Does filtering work with 2005?
  18. Todd
    Todd avatar
    24 posts
    Member since:
    Sep 2007

    Posted 08 Oct 2008 Link to this post

      Here is the full error. 

    Server Error in '/I2/EngineeringPerformance' Application.

    Unable to cast object of type 'ASP.ui_navs_mainlayout_master' to type 'Telerik.Web.UI.GridTableView'.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidCastException: Unable to cast object of type 'ASP.ui_navs_mainlayout_master' to type 'Telerik.Web.UI.GridTableView'.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [InvalidCastException: Unable to cast object of type 'ASP.ui_navs_mainlayout_master' to type 'Telerik.Web.UI.GridTableView'.]
       Telerik.Web.UI.RadGrid.RaisePostBackEvent(String eventArgument) +2267
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +174
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
    


    Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832
  19. Todd
    Todd avatar
    24 posts
    Member since:
    Sep 2007

    Posted 08 Oct 2008 Link to this post

    I just tried to use a RadAjaxManager but got the following error when running the app...
    I am defintely missing something that is prohibiting these controls from working.  If you could provide me of a list of things needed to run these controls I would appreciate it.  thanks.
     

    Server Error in '/I2/EngineeringPerformance' Application.

    The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).]
       System.Web.UI.ControlCollection.AddAt(Int32 index, Control child) +2105879
       Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) +123
    
    [HttpException (0x80004005): Please, see whether wrapping the code block, generating the exception, within RadCodeBlock resolves the error.]
       Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) +171
       Telerik.Web.UI.RadAjaxControl.PerformRender() +466
       Telerik.Web.UI.RadAjaxControl.OnPageRender(HtmlTextWriter writer, Control page) +1243
       Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) +87
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +2113547
       System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +24
       System.Web.UI.Page.Render(HtmlTextWriter writer) +26
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1896
    


    Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832
  20. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 08 Oct 2008 Link to this post

    Todd-

    The second issue is unrelated to the first. When you use RadAjax to auto-ajaxify a page, you need to wrap any <% %> code blocks in a RadCodeBlock control. This enables RadAjax to correctly parse the page and eliminates the second error you've listed.

    As for the original trouble, it's hard to say exactly what's happening since this is an evironment issue. The RadControls work fine with VS 2005 and .NET 2 + Ajax Extensions, so there is some error in your local configuration that is triggering this behavior.

    At this point, I'd suggest that you try creating a brand new ASP.NET AJAX Website. Add the RadGrid to a simple page (along with the required ScriptManager) and see what happens. If everything is setup correclty on your PC, these basic steps should work. If they do, we can keep troubleshooting your app. If they don't, we know there's a bigger configuration issue at play that needs to be solved.

    Give that test a try and let us know what happens.

    -Todd
  21. Todd
    Todd avatar
    24 posts
    Member since:
    Sep 2007

    Posted 09 Oct 2008 Link to this post

    I added the Code Block around the controls.  The <% and %> are actually in javascript on the ascx page.  I don't see the same error now after adding the Code Block control but I am now seeing a javascript error:
    Error: 'Sys.WebForms.PageRequestManager' is null or not an object.
    I am including the code for the ascx page.  Could you please tell me if I have included the RadCodeBlock in the correct location?  Thanks.
    Also, I'll try creating a new project and see if that fixes the other issue.
    <%@ Control Language="vb" AutoEventWireup="false" Codebehind="HWLeftSideMenu.ascx.vb" Inherits="EngineeringPerformance.HWLeftSideMenu" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %> 
    <%@ Register Assembly="Telerik.Web.UI, Version=2008.2.1001.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4" 
        Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
    <%@ Register Assembly="RadCalendar.Net2" Namespace="Telerik.WebControls" TagPrefix="radCln" %> 
    <%@ Register Assembly="RadAjax.Net2" Namespace="Telerik.WebControls" TagPrefix="radA" %> 
    <LINK media="screen" href="../../App_Themes/Styles.css" type="text/css" rel="stylesheet">  
    <LINK media="print" href="../../App_Themes/printstyle.css" type="text/css" rel="stylesheet">  
    <LINK media="screen" href="../../App_Themes/layout.css" type="text/css" rel="stylesheet">  
    <script language="JavaScript" src="../../../javascript/functions.js" type="text/javascript"></script> 
    <script language="JavaScript">  
          
        function clearListbox(listboxName) {  
            if (listboxName == 'lbProject') {  
                document.getElementById('_ctl0_ContentPlaceHolder1_HWLeftSideMenu1_lbSubsystem').options.length=0;  
                document.getElementById('_ctl0_ContentPlaceHolder1_HWLeftSideMenu1_lbCauseCode').options.length=0;  
                document.getElementById('_ctl0_ContentPlaceHolder1_HWLeftSideMenu1_lbDirectorate').options.length=0;  
            } else if (listboxName == 'lbSubsystem') {  
                document.getElementById('_ctl0_ContentPlaceHolder1_HWLeftSideMenu1_lbCauseCode').options.length=0;  
                document.getElementById('_ctl0_ContentPlaceHolder1_HWLeftSideMenu1_lbDirectorate').options.length=0;  
            }  
        }  
        function Alt() {  
            window.alert(document.getElementById('_ctl0_ContentPlaceHolder1_HWLeftSideMenu1_lbProject').value);  
        }  
          
        function Tip(Caption, InMsg, Position) {  
        var Msg;  
     
        Msg = InMsg;  
          
        return overlib(Msg);  
        }  
         
          
        function expandWindow(listboxName) {  
            document.getElementById('_ctl0_ContentPlaceHolder1_HWLeftSideMenu1_' + listboxName).size = 20;  
            if (listboxName == 'lbProject') {  
                document.getElementById('<%=imgProjectsOpen.ClientID%>').style.display='none';   
                document.getElementById('<%=imgProjectsClose.ClientID%>').style.display='';   
            }  
            else if (listboxName == 'lbSubsystem') {  
                document.getElementById('<%=imgSubsystemsOpen.ClientID%>').style.display='none';   
                document.getElementById('<%=imgSubsystemsClose.ClientID%>').style.display='';   
            }  
            else if (listboxName == 'lbCauseCode') {  
                document.getElementById('<%=imgCauseCodesOpen.ClientID%>').style.display='none';   
                document.getElementById('<%=imgCauseCodesClose.ClientID%>').style.display='';   
            }  
            else if (listboxName == 'lbDirectorate') {  
                document.getElementById('<%=imgDirectoratesOpen.ClientID%>').style.display='none';   
                document.getElementById('<%=imgDirectoratesClose.ClientID%>').style.display='';   
            }  
            document.getElementById('mainTable').height = parseInt(document.getElementById('mainTable').height) + parseInt('225');  
        }  
        function shrinkWindow(listboxName) {  
            document.getElementById('_ctl0_ContentPlaceHolder1_HWLeftSideMenu1_' + listboxName).size = 4;  
            if (listboxName == 'lbProject') {  
                document.getElementById('<%=imgProjectsOpen.ClientID%>').style.display='';   
                document.getElementById('<%=imgProjectsClose.ClientID%>').style.display='none';   
            }  
            else if (listboxName == 'lbSubsystem') {  
                document.getElementById('<%=imgSubsystemsOpen.ClientID%>').style.display='';   
                document.getElementById('<%=imgSubsystemsClose.ClientID%>').style.display='none';   
            }  
            else if (listboxName == 'lbCauseCode') {  
                document.getElementById('<%=imgCauseCodesOpen.ClientID%>').style.display='';   
                document.getElementById('<%=imgCauseCodesClose.ClientID%>').style.display='none';   
            }  
            else if (listboxName == 'lbDirectorate') {  
                document.getElementById('<%=imgDirectoratesOpen.ClientID%>').style.display='';   
                document.getElementById('<%=imgDirectoratesClose.ClientID%>').style.display='none';   
            }  
            document.getElementById('mainTable').height = parseInt(document.getElementById('mainTable').height) - parseInt('225');  
        }     
        function clearCauseCodeCheckboxes() {  
            document.getElementById('_ctl0_ContentPlaceHolder1_HWLeftSideMenu1_cbNonDefectCC').checked = false;  
            document.getElementById('_ctl0_ContentPlaceHolder1_HWLeftSideMenu1_cbDefectCC').checked = false;  
            //document.getElementById('HWLeftSideMenu1:tbCheckboxesCleared').text = "True";  
        }  
        function openHelp()  
        {  
            window.open("HWLeftSideHelp.aspx","Help","menubar=yes,width=600,height=350,screenX=100,left=10,screenY=100,top=10,status=no,resizable=yes,toolbar=no,scrollbars=yes");  
        }  
        function advancedAnalysisCharts()  
        {  
            window.open("http://etwk-rpt001.twk.us.ray.com/cognos8","AdvancedAnalysisCharts","menubar=yes,width=1000,height=700,screenX=100,left=10,screenY=100,top=10,status=no,resizable=yes,toolbar=no,scrollbars=yes");  
        }  
        function checkListboxes()  
        {  
            if (document.getElementById('_ctl0_ContentPlaceHolder1_HWLeftSideMenu1_lbSubsystem').options.length == 0)  
            {  
                window.alert("You must select the Apply Button for Projects before submitting your changes.");  
                return false;  
            } else if ((document.getElementById('_ctl0_ContentPlaceHolder1_HWLeftSideMenu1_lbCauseCode').options.length == 0) && (document.getElementById('HWLeftSideMenu1:lbDirectorate').options.length == 0))  
            {  
                window.alert("You must select the Apply Button for Subsystems before submitting your changes.");  
                return false;  
            }   
            return true;  
        }  
        function openIDRCNWin()   
        {  
            window.open("HWIDRCNOpenAgeDefects.aspx?varDays=All&varPriority=Total","AllIDRCNOpenActions","menubar=yes,width=900,height=600,screenX=100,left=10,screenY=100,top=10,status=no,resizable=yes,toolbar=no,scrollbars=yes");  
            return true;  
        }  
        function openIDRWin()   
        {  
            window.open("HWIDROpenAgeDefects.aspx?varDays=All&varPriority=Total","AllIDROpenActions","menubar=yes,width=900,height=600,screenX=100,left=10,screenY=100,top=10,status=no,resizable=yes,toolbar=no,scrollbars=yes");  
            return true;  
        }  
        function openCNWin()   
        {  
            window.open("HWCNOpenAgeDefects.aspx?varDays=All&varPriority=Total","AllCNOpenActions","menubar=yes,width=900,height=600,screenX=100,left=10,screenY=100,top=10,status=no,resizable=yes,toolbar=no,scrollbars=yes");  
            return true;  
        }  
          
    </script> 
     
        <!-- Column One Start --> 
        <div class="column-1-wrapper" id="no-print">  
            <div class="column-1">  
                <table> 
                    <tr> 
                        <td colSpan="3" rowspan="">  
                            <href="javascript:openHelp()" class="hlt1">Help  
                                <asp:TextBox id="tbValidSubmit" runat="server" Visible="False" Width="65px">True</asp:TextBox></a>  
                            <hr> 
                            <asp:linkbutton id="buttonAdvancedAnalysisCharts" Runat="server">  
                                    <class="hlt1" href="javascript:advancedAnalysisCharts()">Advanced Analysis Charts</a></asp:linkbutton> 
                            <asp:linkbutton CssClass=hlt1 id="buttonHWThresholds" runat="server">HW Thresholds</asp:linkbutton> 
                            <asp:linkbutton CssClass=hlt1 id="buttonNWAAdminForm" runat="server">NWA Admin Form</asp:linkbutton> 
                            <telerik:RadAjaxManager  
                                ID="RadAjaxManager2" runat="server">  
                                <AjaxSettings> 
                                    <telerik:AjaxSetting AjaxControlID="lbProject">  
                                        <UpdatedControls> 
                                            <telerik:AjaxUpdatedControl ControlID="lbSubsystem" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                                            <telerik:AjaxUpdatedControl ControlID="lbCauseCode" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                                            <telerik:AjaxUpdatedControl ControlID="lbDirectorate" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                                        </UpdatedControls> 
                                    </telerik:AjaxSetting> 
                                    <telerik:AjaxSetting AjaxControlID="AllProjectsButton">  
                                        <UpdatedControls> 
                                            <telerik:AjaxUpdatedControl ControlID="lbProject" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                                            <telerik:AjaxUpdatedControl ControlID="lbSubsystem" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                                            <telerik:AjaxUpdatedControl ControlID="lbCauseCode" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                                            <telerik:AjaxUpdatedControl ControlID="lbDirectorate" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                                        </UpdatedControls> 
                                    </telerik:AjaxSetting> 
                                    <telerik:AjaxSetting AjaxControlID="bApplyProjects">  
                                        <UpdatedControls> 
                                            <telerik:AjaxUpdatedControl ControlID="lbSubsystem" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                                            <telerik:AjaxUpdatedControl ControlID="lbCauseCode" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                                            <telerik:AjaxUpdatedControl ControlID="lbDirectorate" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                                        </UpdatedControls> 
                                    </telerik:AjaxSetting> 
                                    <telerik:AjaxSetting AjaxControlID="lbSubsystem">  
                                        <UpdatedControls> 
                                            <telerik:AjaxUpdatedControl ControlID="lbCauseCode" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                                            <telerik:AjaxUpdatedControl ControlID="lbDirectorate" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                                        </UpdatedControls> 
                                    </telerik:AjaxSetting> 
                                    <telerik:AjaxSetting AjaxControlID="AllSubsystemsButton">  
                                        <UpdatedControls> 
                                            <telerik:AjaxUpdatedControl ControlID="lbSubsystem" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                                            <telerik:AjaxUpdatedControl ControlID="lbCauseCode" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                                            <telerik:AjaxUpdatedControl ControlID="lbDirectorate" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                                        </UpdatedControls> 
                                    </telerik:AjaxSetting> 
                                    <telerik:AjaxSetting AjaxControlID="bApplySubsystems">  
                                        <UpdatedControls> 
                                            <telerik:AjaxUpdatedControl ControlID="lbCauseCode" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                                            <telerik:AjaxUpdatedControl ControlID="lbDirectorate" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                                        </UpdatedControls> 
                                    </telerik:AjaxSetting> 
                                    <telerik:AjaxSetting AjaxControlID="AllDirectoratesButton">  
                                        <UpdatedControls> 
                                            <telerik:AjaxUpdatedControl ControlID="lbDirectorate" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                                        </UpdatedControls> 
                                    </telerik:AjaxSetting> 
                                </AjaxSettings> 
                            </telerik:RadAjaxManager> 
                            <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">                          
                            <hr> 
                            <asp:Image ID="imgProjectsOpen" runat="server" align=left ImageUrl="~/images/plus.gif" ToolTip="Expand Project Picklist" /> 
                            <asp:Image ID="imgProjectsClose" runat="server" align=left style="display:none" ImageUrl="~/images/minus.gif" ToolTip="Collapse Project Picklist" /> 
                            <asp:label id="lProject" runat="server" CssClass="hlt1" BorderWidth="0px">Projects:</asp:label> 
                            <asp:listbox id="lbProject" runat="server" CssClass="hlt1" Width="142px" SelectionMode="Multiple"></asp:listbox> 
                            <asp:button id="AllProjectsButton" runat="server" Text="Select All"></asp:button><asp:button id="bApplyProjects" runat="server" Text="Apply"></asp:button> 
                            <hr> 
                            <asp:Image ID="imgSubsystemsOpen" runat="server" align=left ImageUrl="~/images/plus.gif" ToolTip="Expand Subsystem Picklist" /> 
                            <asp:Image ID="imgSubsystemsClose" runat="server" align=left style="display:none" ImageUrl="~/images/minus.gif" ToolTip="Collapse Subsystem Picklist" /> 
                            <asp:label id="lSubsystem" runat="server" CssClass="hlt1">Subsystems:</asp:label><asp:listbox id="lbSubsystem" runat="server" CssClass="hlt1" Width="142px" SelectionMode="Multiple"></asp:listbox><asp:button id="AllSubsystemsButton" runat="server" Text="Select All"></asp:button><asp:button id="bApplySubsystems" runat="server" Text="Apply"></asp:button> 
                            <hr> 
                            <asp:Image ID="imgCauseCodesOpen" runat="server" align=left ImageUrl="~/images/plus.gif" ToolTip="Expand Cause Codes Picklist" /> 
                            <asp:Image ID="imgCauseCodesClose" runat="server" align=left style="display:none" ImageUrl="~/images/minus.gif" ToolTip="Collapse Cause Codes Picklist" /> 
                            <asp:label id="lCauseCode" runat="server" CssClass="hlt1">Cause Codes:</asp:label> 
                            <asp:listbox id="lbCauseCode" runat="server" CssClass="hlt1" Width="142px" SelectionMode="Multiple"></asp:listbox> 
                            <asp:CheckBox CssClass="hlt1" id="cbNonDefectCC" runat="server" Text="All Non-Defects" AutoPostBack="True"></asp:CheckBox> 
                            <asp:CheckBox CssClass="hlt1" id="cbDefectCC" runat="server" Text="All Defects" AutoPostBack="True" 
                                Checked="True"></asp:CheckBox> 
                            <hr> 
                            <asp:Image ID="imgDirectoratesOpen" runat="server" align=left ImageUrl="~/images/plus.gif" ToolTip="Expand Directorates Picklist" /> 
                            <asp:Image ID="imgDirectoratesClose" runat="server" align=left style="display:none" ImageUrl="~/images/minus.gif" ToolTip="Collapse Directorates Picklist" /> 
                            <asp:label id="lDirectorate" runat="server" CssClass="hlt1">Directorates:</asp:label> 
                            <asp:listbox id="lbDirectorate" runat="server" CssClass="hlt1" Width="142px" SelectionMode="Multiple"></asp:listbox><asp:button id="AllDirectoratesButton" runat="server" Text="Select All"></asp:button> 
                            <hr> 
                            </telerik:RadCodeBlock> 
                        </td> 
                    </tr> 
                    <tr> 
                        <td class="hlt1">  
                            CN/IDR Orig_Date<br /> 
                            (Doc_Checking Close_Date)<br /><br /> 
                            <asp:label id="lStart" runat="server" CssClass="hlt1">From Date:</asp:label> 
                        </td> 
                    </tr> 
                    <tr> 
                        <td> 
                            <telerik:RadDatePicker ID="RadStartDate" runat="server" Width="135px">  
                                <Calendar UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False" ViewSelectorText="x">  
                                </Calendar> 
                            </telerik:RadDatePicker> 
                        </td> 
                    </tr> 
                    <tr> 
                        <td><asp:label id="lEnd" runat="server" CssClass="hlt1">To Date:</asp:label></td>  
                    </tr> 
                    <tr> 
                        <td> 
                            <telerik:RadDatePicker ID="RadEndDate" runat="server" Width="135px">  
                                <Calendar UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False" ViewSelectorText="x">  
                                </Calendar> 
                            </telerik:RadDatePicker> 
                        </td> 
                    </tr> 
                    <tr> 
                        <td colSpan="2">  
                            &nbsp;  
                            <hr> 
                            <asp:button id="submitButton" runat="server" Text="Submit"></asp:button> 
                        </td> 
                    </tr> 
                </table> 
                <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" 
                    Width="75px">  
                    <img alt="Loading..." src="../../../images/progressbar.gif" style="border-right: 0px;  
                        border-top: 0px; border-left: 0px; border-bottom: 0px" width="128" /> 
                </telerik:RadAjaxLoadingPanel> 
            </div> 
        </div> 
        <!-- Column One End --> 
     
     
     
    The expandwindow and shrinkwindow javascript functions are called from the page load in the code behind:

    imgProjectsOpen.Attributes.Add(

    "onClick", "return expandWindow('lbProject');")

     

    imgProjectsClose.Attributes.Add(

    "onClick", "return shrinkWindow('lbProject');")

     

    imgSubsystemsOpen.Attributes.Add(

    "onClick", "return expandWindow('lbSubsystem');")

     

    imgSubsystemsClose.Attributes.Add(

    "onClick", "return shrinkWindow('lbSubsystem');")

     

    imgCauseCodesOpen.Attributes.Add(

    "onClick", "return expandWindow('lbCauseCode');")

     

    imgCauseCodesClose.Attributes.Add(

    "onClick", "return shrinkWindow('lbCauseCode');")

     

    imgDirectoratesOpen.Attributes.Add(

    "onClick", "return expandWindow('lbDirectorate');")

     

    imgDirectoratesClose.Attributes.Add(

    "onClick", "return shrinkWindow('lbDirectorate');")

     


  22. Todd
    Todd avatar
    24 posts
    Member since:
    Sep 2007

    Posted 14 Oct 2008 Link to this post

    I have figured out my errors.  Looks like the ScriptManager needs to be on the same page as the controls.  I had included it on the master page as I had read somewhere, but obviously you run into issues with that approach.
  23. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 14 Oct 2008 Link to this post

    I see...I must have overlooked that in your code. Yes, when you use MasterPages, you can run in to trouble with the ScriptManager in some scenarios. The best guidance for MasterPages is to use the ScriptManager on your MasterPage and then use ScriptManagerProxy controls in your ContentPages and your UserControls.

    Either way, happy you found your solution!

    -Todd
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017