locked
Error with PopupControlExtender Microsoft JScript runtime error: Sys.ArgumentUndefinedException: Value cannot be undefined. Parameter name: type RRS feed

  • Question

  • User-119692196 posted

    hi ,

    I've been trying to make a grid with some data from a database and when I hover or click on a certain column I want a PopupControlExtender to appear and give me extra information.

    I am trying to do something similar to this. Except I dont want to use an magnifying image, I just want to hover over a column(for example Product Name column) 

    However everytime I hover over the column I keep getting this error

    Microsoft JScript runtime error: Sys.ArgumentUndefinedException: Value cannot be undefined.
    Parameter name: type

    I can't seem to find anything that helps me, I've been trying to debug this for a day now and got nothing. Can anyone help me?

    my markup:

    <%@ Page Title="Tracking Tool" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="true"
        CodeFile="Default.aspx.vb" Inherits="_Default" %>
        <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
    
    <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    </asp:Content>
    <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
        <asp:ToolkitScriptManager ID="ScriptManager1" runat="server">
    </asp:ToolkitScriptManager>
        <asp:Label ID="Lbl_MaterialType" runat="server" Text="Material Type:"></asp:Label>
        <asp:DropDownList ID="Ddl_MaterialType" runat="server" OnSelectedIndexChanged="Ddl_MaterialType_SelectedIndexChanged" AutoPostBack="True"></asp:DropDownList>
             
        <asp:GridView ID="Gvw_Batches" runat="server" CssClass="Grid" AutoGenerateColumns="False"  OnRowDataBound="Gvw_Batches_RowDataBound" OnRowCommand="Gvw_Batches_Rowcommand" OnRowUpdating="Gvw_Batches_RowUpdating" OnSelectedIndexChanged="Gvw_Batches_SelectedIndexChanged"  onrowcreated="Gvw_Batches__RowCreated" >
            <Columns>
           
            <asp:ButtonField  Text="SingleClick"  CommandName="SingleClick"  Visible="false"   />    
          
          <asp:TemplateField HeaderText="ORIGREC" Visible ="false" >
                <ItemTemplate>
                    <asp:Label ID="ORIGRECLabel" runat="server" Text='<%# Eval("ORIGREC") %>'></asp:Label>
                      <asp:TextBox ID="ORIGREC" runat="server" Text='<%# Eval("ORIGREC") %>' Width="175px" visible="true"></asp:TextBox>
                </ItemTemplate>
            </asp:TemplateField>
    
            <asp:TemplateField HeaderText="Material Code"  >
                <ItemTemplate>
                    <asp:Label ID="MATCODELabel" runat="server" Text='<%# Eval("MATCODE") %>'></asp:Label>
                      <asp:TextBox ID="MATCODE" runat="server" Text='<%# Eval("MATCODE") %>' Width="175px" visible="false"></asp:TextBox>
                </ItemTemplate>
            </asp:TemplateField>
    
             <asp:TemplateField HeaderText="Material Name"  >
                <ItemTemplate>
                    <asp:Label ID="MATNAMELabel" runat="server" Text='<%# Eval("MATNAME") %>'></asp:Label>
                      <asp:TextBox ID="MATNAME" runat="server" Text='<%# Eval("MATNAME") %>' Width="175px" visible="false"></asp:TextBox>
                </ItemTemplate>
            </asp:TemplateField>
    
           <asp:TemplateField HeaderText="Received Date">
                <ItemTemplate>
                    <asp:Label ID="ReceivedDateLabel" runat="server" Text='<%# Eval("SAMPDATE") %>'></asp:Label>
                    <asp:TextBox ID="ReceivedDate" runat="server" Text='<%# Eval("SAMPDATE") %>' Width="175px" visible="false"></asp:TextBox>
                    <asp:CalendarExtender ID="ReceivedDateExtender"  TargetControlID="ReceivedDate"  runat="server"  Format="dd/MM/yyyy"  >
                    </asp:CalendarExtender>
                </ItemTemplate>
            </asp:TemplateField>
    
            <asp:TemplateField HeaderText="QA Due Date">
                <ItemTemplate>
                    <asp:Label ID="QADueDateLabel" runat="server" Text='<%# Eval("SAMPDATE") %>'></asp:Label>
                    <asp:TextBox ID="QADueDate" runat="server" Text='<%# Eval("SAMPDATE") %>' Width="175px" visible="false"></asp:TextBox>
                    <asp:CalendarExtender ID="QADueDateExtender"  TargetControlID="QADueDate"  runat="server"  Format="dd/MM/yyyy" >
                    </asp:CalendarExtender>
                </ItemTemplate>
            </asp:TemplateField>
               <asp:TemplateField HeaderText="Physical Testing" ItemStyle-Width="40" ItemStyle-HorizontalAlign="Right" >
                <ItemTemplate>
                    <asp:Label ID="PhysicalTestingLabel" runat="server" Text='<%# Eval("physicalTestComplete") & "/" & Eval("physicalTotal")  %>'></asp:Label>
                     <asp:PopupControlExtender 
                        ID="PopupControlExtender1"
                        runat="server"
                        TargetControlID="PhysicalTestingLabel"
                        PopupControlID="Pnl_TestExtender"
                        DynamicContextKey='<%# Eval("MATCODE") %>' 
                        DynamicControlID="Pnl_TestExtender" 
                        DynamicServiceMethod="GetDynamicContent" 
                        >
                    </asp:PopupControlExtender >
    
               </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Name" >
                <ItemTemplate>
                    <asp:Label ID="PhysicalTestingNameLabel" runat="server" Text='<%# Eval("ORIGREC") %>'></asp:Label>
                      <asp:TextBox ID="PhysicalTestingName" runat="server" Text='<%# Eval("ORIGREC") %>' Width="175px" visible="false"></asp:TextBox>
                </ItemTemplate>
            </asp:TemplateField>
             <asp:TemplateField HeaderText="Instrumentation Testing"  >
                <ItemTemplate>
                    <asp:Label ID="InstrumentationTestingLabel" runat="server" Text='<%# Eval("instrumentationTestComplete") & "/" & Eval("instrumentationTotal")  %>'></asp:Label>
                      <asp:TextBox ID="InstrumentationTesting" runat="server" Text='<%# Eval("instrumentationTestComplete") & "/" & Eval("instrumentationTotal")  %>' Width="175px" visible="false"></asp:TextBox>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Name" >
                <ItemTemplate>
                    <asp:Label ID="InstrumentationTestingNameLabel" runat="server" Text='<%# Eval("ORIGREC") %>'></asp:Label>
                      <asp:TextBox ID="InstrumentationTestingName" runat="server" Text='<%# Eval("ORIGREC") %>' Width="175px" visible="false"></asp:TextBox>
                </ItemTemplate>
            </asp:TemplateField>
               <asp:TemplateField HeaderText="Microbiology"  >
                <ItemTemplate>
                    <asp:Label ID="MicrobiologyTestingLabel" runat="server" Text='<%# Eval("microbiologyTestComplete") & "/" & Eval("microbiologyTotal")  %>'></asp:Label>
                      <asp:TextBox ID="MicrobiologyTesting" runat="server" Text='<%# Eval("microbiologyTestComplete") & "/" & Eval("microbiologyTotal")  %>' Width="175px" visible="false"></asp:TextBox>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Name" >
                <ItemTemplate>
                    <asp:Label ID="MicrobiologyTestingNameLabel" runat="server" Text='<%# Eval("ORIGREC") %>'></asp:Label>
                      <asp:TextBox ID="MicrobiologyTestingName" runat="server" Text='<%# Eval("ORIGREC") %>' Width="175px" visible="false"></asp:TextBox>
                </ItemTemplate>
            </asp:TemplateField>
               <asp:TemplateField HeaderText="Other"  >
                <ItemTemplate>
                    <asp:Label ID="OtherTestingLabel" runat="server" Text='<%# Eval("otherTestComplete") & "/" & Eval("otherTotal")  %>'></asp:Label>
                      <asp:TextBox ID="OtherTesting" runat="server" Text='<%# Eval("otherTestComplete") & "/" & Eval("otherTotal")  %>' Width="175px" visible="false"></asp:TextBox>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Name" >
                <ItemTemplate>
                    <asp:Label ID="OtherTestingNameLabel" runat="server" Text='<%# Eval("ORIGREC") %>'></asp:Label>
                      <asp:TextBox ID="OtherTestingName" runat="server" Text='<%# Eval("ORIGREC") %>' Width="175px" visible="false"></asp:TextBox>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Reviewed"  >
                <ItemTemplate>
                    <asp:Label ID="ReviewedLabel" runat="server" Text='<%# Eval("ReviewedComplete") & "/" & Eval("ReviewedTotal")  %>'></asp:Label>
                      <asp:TextBox ID="Reviewed" runat="server" Text='<%# Eval("ReviewedComplete") & "/" & Eval("ReviewedTotal")  %>' Width="175px" visible="false"></asp:TextBox>
                </ItemTemplate>
            </asp:TemplateField>
            </Columns>
         </asp:GridView>
    
                      <asp:Panel ID="Pnl_TestExtender" runat="server" >       
                       </asp:Panel>
                   
    </asp:Content>
    

    And my code behind:

     Protected Sub Gvw_Batches__RowCreated(sender As Object, e As GridViewRowEventArgs)
            If e.Row.RowType = DataControlRowType.DataRow Then
                Dim pce As PopupControlExtender = TryCast(e.Row.FindControl("PopupControlExtender1"), PopupControlExtender)
    
                Dim behaviorID As String = "pce_" + e.Row.RowIndex.ToString
                pce.BehaviorID = behaviorID
    
                Dim lbl As Label = DirectCast(e.Row.FindControl("PhysicalTestingLabel"), Label)
    
                Dim OnMouseOverScript As String = String.Format("$find('{0}').showPopup();", behaviorID)
                Dim OnMouseOutScript As String = String.Format("$find('{0}').hidePopup();", behaviorID)
    
                lbl.Attributes.Add("onmouseover", OnMouseOverScript)
                lbl.Attributes.Add("onmouseout", OnMouseOutScript)
            End If
        End Sub
    
    
        <System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()> _
        Public Shared Function GetDynamicContent(contextKey As String) As String
    
            Dim b As New StringBuilder()
          
    
            Dim rowing = GenerateTestBatchTable(contextKey)
            For Each row In rowing
    
    
    
    
                b.Append("<table style='background-color:#f3f3f3; border: #336699 3px solid; ")
                b.Append("width:350px; font-size:10pt; font-family:Verdana;' cellspacing='0' cellpadding='3'>")
    
                b.Append("<tr><td colspan='3' style='background-color:#336699; color:white;'>")
                b.Append("<b>Product Details</b>")
                b.Append("</td></tr>")
                b.Append("<tr><td style='width:80px;'><b>Unit Price</b></td>")
                b.Append("<td style='width:80px;'><b>Stock</b></td>")
                b.Append("<td><b>Description</b></td></tr>")
    
                b.Append("<tr>")
                b.Append("<td>$" + row("'<%# Eval(""Analyte"") %>'").ToString() + "</td>")
                b.Append("</tr>")
    
                b.Append("</table>")
            Next
    
            Return b.ToString()
        End Function
    

    Thank you for your help

    Thursday, March 20, 2014 9:45 AM

Answers

  • User-933407369 posted

    I check out the demo: http://www.ezzylearning.com/tutorial.aspx?tid=2861497

    At last, i found the solution . you have to replace the AjaxControlToolkit.dll with old version above . click here to download the AjaxControlToolkit.dll.

    i try  to update the later version AjaxControlToolkit.7.1213 with the AjaxControlToolkit 3.5. 4.0,4.5 , they failed.

    i think that the latest version AjaxControlToolkit Changed some previous initialization method.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 21, 2014 1:27 AM
  • User108328858 posted

    Hi There,

    i started to have the same issue after updating to the AJAX Control Toolkit — December 2013 Release.

    The error seems so be generated by the $find('pce_WahteverBehaviorID').showPopup();

    An this is generated by the following line of code:

      Dim behaviorID As String = "pce_" + e.Row.RowIndex.ToString
                pce.BehaviorID = behaviorID
    
                Dim lbl As Label = DirectCast(e.Row.FindControl("PhysicalTestingLabel"), Label)
      Dim OnMouseOverScript As String = String.Format("$find('{0}').showPopup();", behaviorID)

    This code was working perfectly with the previous version of the control toolkit, so something seems to have changed confliting with this solution to handle popups in GridView....

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 26, 2014 5:58 AM

All replies

  • User-933407369 posted

    I check out the demo: http://www.ezzylearning.com/tutorial.aspx?tid=2861497

    At last, i found the solution . you have to replace the AjaxControlToolkit.dll with old version above . click here to download the AjaxControlToolkit.dll.

    i try  to update the later version AjaxControlToolkit.7.1213 with the AjaxControlToolkit 3.5. 4.0,4.5 , they failed.

    i think that the latest version AjaxControlToolkit Changed some previous initialization method.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 21, 2014 1:27 AM
  • Monday, March 24, 2014 12:04 AM
  • User-119692196 posted

    I tried with the old ajaxControlToolkit.dll and I get the same mistake. The demo isnt exactly the same thing as my application :(

    Tuesday, March 25, 2014 3:52 PM
  • User-119692196 posted

    I still get an error when I set debug to false

    Tuesday, March 25, 2014 3:54 PM
  • User-933407369 posted
     I still get an error when I set debug to false

    where you set the debug to false? if you set the page tag, it works for me.

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="PopupControlExtenderDemo.aspx.vb" Inherits="PopupControlExtenderDemo" Debug="false" %>

    if you download the demo: http://www.ezzylearning.com/tutorial.aspx?tid=2861497, then you press F5 to  run it in your VS directly. Is it working for you ?

    if it is not working for you , you'd better provide a demo which can easily reproduce the problem. (upload: SkyDrive - Microsoft)

    Thank you for your understanding.

    Tuesday, March 25, 2014 10:19 PM
  • User108328858 posted

    Hi There,

    i started to have the same issue after updating to the AJAX Control Toolkit — December 2013 Release.

    The error seems so be generated by the $find('pce_WahteverBehaviorID').showPopup();

    An this is generated by the following line of code:

      Dim behaviorID As String = "pce_" + e.Row.RowIndex.ToString
                pce.BehaviorID = behaviorID
    
                Dim lbl As Label = DirectCast(e.Row.FindControl("PhysicalTestingLabel"), Label)
      Dim OnMouseOverScript As String = String.Format("$find('{0}').showPopup();", behaviorID)

    This code was working perfectly with the previous version of the control toolkit, so something seems to have changed confliting with this solution to handle popups in GridView....

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 26, 2014 5:58 AM
  • User-119692196 posted

    I tried changing my version again to an older one and it works! thanks so much!!!!

    Wednesday, March 26, 2014 9:25 AM
  • User-1778014415 posted

    Thanks, it worked for me ! 

    Using the latest version of the Toolkit did not work. Had to use the old DLL.

    Monday, April 7, 2014 3:34 PM