Member 9445358 Ответов: 3

Microsoft JScript runtime error: Sys.ArgumentNullException: Value не может быть null


Я получаю следующую ошибку:
Microsoft JScript runtime error: Sys.ArgumentNullException: значение не может быть null.
Имя параметра: panelsCreated[1]
указывая на следующий код в файле(ScriptResource.axd...[динамический]):
$type.registerClass('Sys.WebForms.InitializeRequestEventArgs', Sys.CancelEventArgs);
$type = Sys.WebForms.PageLoadedEventArgs = function PageLoadedEventArgs(panelsUpdated, panelsCreated, dataItems) {
    /// <summary locid="M:J#Sys.WebForms.PageLoadedEventArgs.#ctor">The arguments for the PageRequestManager's pageLoaded event. The pageLoaded event is raised after the DOM has been updated.</summary>
    /// <param name="panelsUpdated" type="Array">An array of UpdatePanels that were updated.</param>
    /// <param name="panelsCreated" type="Array">An array of UpdatePanels that were created.</param>
    /// <param name="dataItems" type="Object" mayBeNull="true"></param>
    var e = Function._validateParams(arguments, [
        {name: "panelsUpdated", type: Array},
        {name: "panelsCreated", type: Array},
        {name: "dataItems", type: Object, mayBeNull: true}
    ]);
    if (e) throw e;
    Sys.WebForms.PageLoadedEventArgs.initializeBase(this);

    this._panelsUpdated = panelsUpdated;
    this._panelsCreated = panelsCreated;
    this._dataItems = dataItems || new Object();
}

с выделенной строкой : "if (e) throw e".

Это происходит, когда я нажимаю на кнопку LinkButton 2-й или 3-й раз подряд.
LinkButton успешно вызывает/выполняет метод WebService, а затем выдает ошибку!

Код LinkButton находится ниже:
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:Panel ID="Panel3" runat="server">
    <asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
 <asp:LinkButton ID="LinkButton100" CssClass="calendar" 

        value="LinkButton1" rel="nofollow" runat="server" 

        OnClick="LinkButton1_Click">hi</asp:LinkButton>
 <asp:LinkButton ID="LinkButton60" CssClass="calendar" 

        value="LinkButton60" runat="server" OnClick="LinkButton1_Click">LinkButton
  </asp:LinkButton><br />
  <asp:LinkButton ID="LinkButton120" CssClass="calendar" 

        value="LinkButton120" runat="server"OnClick="LinkButton1_Click">LinkButton12
</asp:LinkButton>
<asp:Panel ID="Panel1" CssClass="popup" runat="server">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="False">
    <ContentTemplate>
         <div>
             Event:
             <asp:Literal ID="Literal1" runat="server"></asp:Literal><br />
             Time:
             <asp:Literal ID="Literal2" runat="server"></asp:Literal><br />
             Location:
             <asp:Literal ID="Literal3" runat="server"></asp:Literal><br />
      </div>
 </ContentTemplate>
   <Triggers>
        <asp:AsyncPostBackTrigger ControlID="LinkButton60" EventName="Click" />
         <asp:AsyncPostBackTrigger ControlID="LinkButton120" EventName="Click" />
 </Triggers>
</asp:UpdatePanel>
 </asp:Panel>
 <asp:BalloonPopupExtender ID="BalloonPopupExtender1" BalloonPopupControlID="Panel1"Position="TopRight" 

     TargetControlID="LinkButton60" runat="server" 

     BalloonSize="Medium"DisplayOnMouseOver="True" 

     DynamicContextKey='1' DynamicControlID="Panel1"

     DynamicServicePath="DynamicPopulate.asmx" 

     DynamicServiceMethod="UpdatePanel1_DynamicPopulateExtender">
</asp:BalloonPopupExtender>
<asp:Panel ID="Panel2" runat="server" 

    CssClass="popup">
<asp:UpdatePanel ID="UpdatePanel2" runat="server" 

     UpdateMode='Conditional' ChildrenAsTriggers="false">
   <ContentTemplate>
           <asp:PlaceHolder ID="PlaceHolder1" 

               runat="server">
                 <asp:Image ID="Image1" Style="height: auto;"

                     ImageUrl="/img/imagename.jpg" 

                     AlternateText="nameofevent"

                     />
            </asp:PlaceHolder>
    </ContentTemplate>
    <Triggers>
           <asp:AsyncPostBackTrigger ControlID="LinkButton60" 

                EventName="Click"  />
               <asp:AsyncPostBackTrigger ControlID="LinkButton120" 

                    EventName="Click" />
     </Triggers>
</asp:UpdatePanel>
</asp:Panel>
<asp:PopupControlExtender ID="PopupControlExtender1"

        runat="server" Position="Bottom" 

        PopupControlID="Panel2" DynamicContextKey="value" 

        DynamicControlID="Panel2" 

        DynamicServiceMethod="PlaceHolder1_DynamicPopulateExtender"

        DynamicServicePath="DynamicPopulate.asmx"

        TargetControlID="LinkButton60">
</asp:PopupControlExtender>
        </ContentTemplate>
    </asp:UpdatePanel>

Метод веб-службы:
       [System.Web.Services.WebMethodAttribute(),
        System.Web.Script.Services.ScriptMethodAttribute()]
       public string PlaceHolder1_DynamicPopulateExtender(string contextKey)
       {
.............builds a string, s
           return s.ToString();
       }

Есть идеи, в чем проблема? или как можно найти его???

3 Ответов

Рейтинг:
23

saboor awan

Установите ScriptMode="Release" вашего ScriptManager.


ken.wyatt

Это устраняет проблему, но знаете ли вы, почему это проблема в первую очередь?

vinayppn

Большое вам спасибо за решение, Сабур.

roopa1984

Большое спасибо..это именно то, что я ищу for..it работает!!!! :)

BD Innovative

хороший братан

Рейтинг:
2

Arnas Mockevičius

При использовании FrameWork 4 и в GridView динамическом создании флажка, кнопки или других элементов управления события будут запускаться в необычном порядке. Page_Load срабатывает после создания записи.


Рейтинг:
1

Ewert Bergh

Setting ScriptMode="Release" is kind of hacking at the leaves instead of the roots. I think "Release" mode is the same for building a project in release mode. i.e. don't give away any debug info. So in essence all you're doing by setting ScriptMode="Release" is hiding the script error message. What I found in my situation is I was creating controls in Page_Init dynamically and they were being created with the same ID. I was also setting multiple selected items in a dynamically created ListBox when the SelectionMode was Single and not Multiple. I think in general if you're creating controls on the fly take care you're setting all the properties on the control correctly too...