This is a migrated thread and some comments may be shown as answers.

Client Events and Postbacks

0 Answers 168 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Marcel
Top achievements
Rank 1
Marcel asked on 19 Mar 2018, 09:33 PM

Hello,

I have 3 web parts each of which raise a different client side event to which the other 2 web parts react. Two of the web parts are asp .NET (Telerik) while the third is strictly client side JavaScript and REST services.

My issue is that the 2 asp .net web parts each perform a post back when they react to the event, passing some data to the server. Only one of the asp .net web parts processes their post back correctly. If the other ASP .NET web part is removed, everything works correctly.

I have considered serializing the post backs, so that one does not occur until the first has completed and rendered back to the client.

Is there a better way? Also my post backs are not showing the loading panel which does appear normally.

My client side event listener and post back code looks like this:

document.addEventListener('ADSBarcodeEvent', function (evt) {
    var barcode = evt.detail[0];
    var assetType = evt.detail[1];
    __doPostBack("<%=HiddenSearchRadButton.UniqueID%>", barcode + "||" + assetType);
}, false);

and on the server:

protected void HiddenSearchRadButton_Click(object sender, EventArgs e)
 {
     ProcessingExternalEvent = true; // stop infinite loop of events
 
     string passedArgument = Request.Params.Get("__EVENTARGUMENT");
     // barcode + "||" + assetType
     if (passedArgument.Contains("||"))
     {
         string[] delimiter = new string[] { "||" };
         string[] arguments = passedArgument.Split(delimiter, StringSplitOptions.None);
         string barcode = arguments[0];
         string assetType = arguments[1];

No answers yet. Maybe you can help?

Tags
Ajax
Asked by
Marcel
Top achievements
Rank 1
Share this question
or