Skip to content

Infragistics Community Forum / Web / Ultimate UI for ASP.NET Web Forms / Triggering Async postback in UpdatePanel containing WebDropDown on WebTab SelectedIndexChanged

Triggering Async postback in UpdatePanel containing WebDropDown on WebTab SelectedIndexChanged

New Discussion
Alex Plant
Alex Plant asked on Nov 29, 2014 4:04 PM

Sorry for the wordy title, but it seemed the best way to describe the issue.

Basically, we have a WebDropDown inside an update panel, whose current value we want to change depending on what WebTab is loaded. We've tried handling the WebTab SelectedIndexChanged event to modify this value, but the update panel doesn't get an Async postback triggered. This is after adding the WebTab as an async postback trigger inside the UpdatePanel too.

I finally got it to work by calling __doPostBack via clicking a button on the ClientEvents-SelectedIndexChanged event, but now I'm presented with this error everytime I change a tab:

Error: Sys.ArgumentUndefinedException: Value cannot be undefined.
Parameter name: type

Any ideas as to what is causing this issue?

Sign In to post a reply

Replies

  • 0
    Vasya Kacheshmarova
    Vasya Kacheshmarova answered on Nov 17, 2014 1:21 PM

    Hello Alex,

    Thank you for posting in our community.

    I followed the described scenario but I was unable to reproduce the behavior that you are describing. I am attaching the sample project I used to test this. Could you please try running it on your side; whether or not it works correctly may help indicate the nature of this issue.

    If this sample is not an accurate demonstration of what you are trying to achieve please feel free to modify it and send it back to me in order to reproduce the issue.

    Please let me know if you have any additional questions regarding this matter.

    • 0
      Alex Plant
      Alex Plant answered on Nov 17, 2014 8:33 PM

      Hi again,

      Thanks for the example file. However, the WebTab has AutoPostBackFlags set to on, as opposed to Async. Setting it to Async stops it from working. I suspect this is because the updatepanel requires a proper post back to be triggered?

      This is why we used JS in our scenario, to trigger an Async postback on the client event SelectedIndexChanged, but this is the point where we run into errors. Looking online suggests we might have incorrexy AJAX assemblies, but all looks in place from what I can see

      • 0
        Alex Plant
        Alex Plant answered on Nov 17, 2014 11:38 PM

        To help further, we have the following update panel:

        <asp:UpdatePanel ID="updatepanel1" runat="server">
        <ContentTemplate>
        <div id="AsAtCtlContainer">
        <jims:AsAt runat="server" ID="AsAtCtl" ExportClientClick = "exportClick();"/><br /><br />
        </div>
        <button onclick="BLOCKED SCRIPT__doPostBack('masterContentBody_updatepanel1', '');" runat="server" id="button1"></button>
        </ContentTemplate>
        </asp:UpdatePanel>

        The 'AsAtCtl' contains a webdropdown that we access through a property to change it. By manually clicking the button, everything works as we want, only the updatepanel is updated, and the date is changed correctly.

        However, if we have ClientEvents-SelectedIndexChanged="doPostBack" in the WebTab, and the following BLOCKED SCRIPT

        <script type="text/javascript">
        function doPostBack()
        {
        document.getElementById("<%:button1.ClientID%>").click();
        }
        </script>

        We get the error. This seems to only happen when EnableLoadOnDemand is set to true as well. 

        Hope that helps!

      • 0
        Alex Plant
        Alex Plant answered on Nov 18, 2014 12:05 AM

        Just in case anyone else is struggling with a similar issue, it appears to be a problem with WHEN you call the javascript function. Moving it from the client side SelectedIndexLoaded to client side AJAXResponse runs it properly (albeit slowly). Just testing now to see what the best client side event is to trigger the function

      • 0
        Vasya Kacheshmarova
        Vasya Kacheshmarova answered on Nov 18, 2014 9:38 AM

        Hello Alex,

        Thank you for getting back to me.

        I set the AutoPostBackFlags to Async, Afterwards I am handling client side ActiveTabChange event. In this event I am triggering a click for the button and everything works as expected, a click is triggered, respectively a postback is fired and selected index of the WebdropDown is changed. Please keep in mind that the EnabledActivation property or WebTab should be set to true in order to fire this event. For example:

        
        

        function WebTab1_ActiveTabChange(sender, eventArgs)

        {

        document.getElementById("Button2").click();

        }

        I modified my sample and I am attaching it for your reference.

        Please let me know if you have any additional questions regarding this matter.

      • 0
        Alex Plant
        Alex Plant answered on Nov 18, 2014 10:24 PM

        Thanks again for your continued support!

        From the looks of it though, that button still causes a full postback? I need the WebDropDown to be updated WITHOUT full postback, and I need it updated after a partial postback from the WebTab. Also note that we have the EnableLoadOnDemand set to true, which seems to cause issues with this. 

        I'll double check the sample with out project, but from what I can see, it's still doing a full postback

        EDIT: this is also being done within an ASP:content page, which inherits from a Master page. Does that change the setup? Still getting a null reference javascript error after implementing your solution into our project

        ANOTHER EDIT: seems having AJAX enabled for the WebTab is causing issues also

      • 0
        Alex Plant
        Alex Plant answered on Nov 19, 2014 2:16 AM

        Main problem is that we need to have AJAX enabled, otherwise the WebDataGridView loses it's content after loading another tab. The problem with having the client side selectedindexchanged is that it seems to do the postback before the server side, which results in no data being loaded. Is there any way to say in the javascript, "Wait until the server side SelectedIndexChanged event has finished doing it's processing, THEN do some stuff"?

      • 0
        Vasya Kacheshmarova
        Vasya Kacheshmarova answered on Nov 19, 2014 2:19 PM

        Hello Alex,

        Currently there Is no way to achieve the mention events order, The reason is that the client side is the one that requests some job to be done on the server. This is the reason why client side events are fired before the server side events.

        However, I modified the sample project in order to achieve only async postbacks . What I am doing is to call __doPostBack for the WebDropDown using __doPostBacks function`s parameters. With setting WebDropown as __EVENTTARGET I am causing async postback for the WebdropDown respectively for the updatePanel. Some further reference about __doPostBack function and its parameters could be found at:

        http://aspalliance.com/articleViewer.aspx?aId=895&pId=-1

        Now in my scenario async postback is triggered when ActiveTabChange event is fired and WebDropDown`s selected index is changed. For example:

        
        

        Client side:

        <script type="text/javascript" id="igClientScript1">

        function causePostBack() {

        __doPostBack('WebDropDown1', ' ');

        }

        function WebTab1_ActiveTabChange(sender, eventArgs) {

        causePostBack();

        }

        </script>

        Server side:

        protected void WebTab1_SelectedIndexChanged(object sender, TabSelectedIndexChangedEventArgs e)

        {

        int index = e.NewIndex;

        this.WebDropDown1.SelectedItemIndex = index;

        }

        I hope you find this information helpful.

        Please let me know if you need any further assistance with this matter.

      • 0
        Alex Plant
        Alex Plant answered on Nov 19, 2014 10:01 PM

        Again, I can't thank you enough!

        I think I've drilled down to the root of the issue. Having a WebDataGrid in one of the ContentTabs seems to be causing the issue.

        Even just putting an empty WebDataGrid into a ContentTabItem, then clicking that tab, causes the following error:

        Line: 4620
        Error: Sys.ArgumentUndefinedException: Value cannot be undefined.
        Parameter name: type

        Again, this WebDataGrid is completely empty, and has been dragged and dropped from the toolbox and nothing else.

        Without the WebDataGrid, everything works fine. Is this an issue with the WebDataGrid, or is there some underlying problem in our code? Again, the given WebTab options work fine without the WebDataGrid, so I'm assuming it's something wrong with how the WebDataGrid is set up.

        Thanks again for all your help!

      • 0
        Alex Plant
        Alex Plant answered on Nov 19, 2014 10:14 PM

        Just to add further to this, I've noticed that the WebDataGrid is always null when I'm debugging. For instance, in the Page_Load event, the WebDataGrid is null.

        EDIT: Looks like the WebDataGrid only loads if it is in the initial selected tab. Any other tabs with a webdatagrid that aren't selected on start up don't seem to get instantiated (using the above WebTab properties). Is the proper behaviour? If it is, is there a way I can force them to be loaded so that I can keep in place the WebTab options we have?

      • 0
        adam eva
        adam eva answered on Nov 29, 2014 4:04 PM

        Hi again,

        Thanks for the example file. 

      • 0
        Zdravko Kolev
        Zdravko Kolev answered on Nov 21, 2014 8:30 AM

        Hello Alex,

        Thank you for the detailed replies. About your question related to newly added WebDataGrid, it should not be related to the mentioned issue, especially if it is empty and haven't set anything to it. Can I ask you, do you use any 3rd party software components like Ajax Control Toolkit? Sometimes this is messing up with our controls and cause issues similar to this one.

        There are some existing methods that can overcome this issue, like:

        – Set debug=false in web.config (http://bjornstad.ws/2010/10/sys-argumentundefinedexception-value-cannot-be-undefined/)

        – Avoid using Clear() function, this is related mostly for WebHierarchicalDataGrid and cannot be related to your issue (http://codecorner.galanter.net/category/javascript/page/4/)

        – Check your ScriptManager/WebScriptManager definition (http://stackoverflow.com/questions/14793415/ajax-toolkit-not-working)

        – Clear your browser cache

        Looking forward to hearing from you.

      • 0
        Alex Plant
        Alex Plant answered on Nov 23, 2014 10:57 PM

        Ended up having a fiddle around and got it to work how I wanted (looks like it was a combination of incorrect properties and controls, but what they were I'm not too sure!). The posts here regarding updating a webdropdown from a webtab helped immensely however!

      • 0
        Zdravko Kolev
        Zdravko Kolev answered on Nov 24, 2014 6:14 AM

        I am glad that you've managed to resolve this issue.

        Thank you for using our controls.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Alex Plant
Favorites
0
Replies
14
Created On
Nov 29, 2014
Last Post
11 years, 3 months ago

Suggested Discussions

Tags

Created by

Created on

Nov 29, 2014 4:04 PM

Last activity on

Feb 16, 2026 9:49 PM