Current filter:
                                You should refresh the page.
                                We apologize for the inconvenience. Our ordering system and the support center may be offline for a few hours on Sunday, May 19 due to maintenance tasks.
                                0
                                  • I am trying to update an ASPxLabel on an ASPxPopUpControl that is called from an ASPxGridview when the user chooses to insert a new record. I am not using the built-in templates of the ASPxGridView. The reason I am not using the built-in templates is because I don't have complete control of the UI design of the template. I prefer the appearance of the popupcontrol. Now my problem is that I can't seem to pass the message from a SQL Server procedure that is returned when the insertion is completed. Whether it succeeds or fails, I want the user to be able to see a message on the popupcontrol before he proceeds to add another record. Is this possible through some javascript which up to this point I have been unable to write or discover in some previous example? I've included all three files for the form that contains these controls in the attached zip, along with a screenshot of what I am looking for. Any assistance greatly appreciated. Thanks!


                                    Peter

                                PopUpControlShowMessageProblem.zip
                                You must  log in  or  register  to leave comments

                                1 Solution

                                0

                                Hi Peter,

                                Your issue is caused by the fact that the callback does not update the whole page. For example, during a callback to the ASPxGridView only the GridView content is updated. As ASPxCallback is not a visible control, the page cannot be updated during its callback. Please refer to the K18387 KB article for more information.

                                You can use the CallbackEventArgs.Result property to pass some text from the server to the client using the ASPxCallback control. You can handle the client-side ASPxClientCallback.CallbackComplete event to get this string. Pass your error message to the client using this parameter and then use the client-side functionality to assign this message to your label.

                                Updated:
                                If you wish to display a text in ASPxLabel, I recommend you initialize the ClientInstanceName property and use its value on the client side to get the control client-side instance. After that, call the ASPxClientLabel.SetText method to set the text.

                                Show all comments
                                • Peter Costantino 07.09.2012

                                  I understand why I'm not seeing the label, but I looked at example E36 and tried to implement a similar approach without success.

                                  This is my C# codebehind code:
                                          protected void cbInsertNewRecord_Callback(object source, CallbackEventArgs e)
                                          {
                                              string s = e.Parameter;
                                              // Split string on '|'.
                                              string[] pm = s.Split('|');

                                              // Get current logged in employee's ID again.
                                              GetEmployeeID();

                                              // Call method that calls SQL update proc.
                                              sMessage = AddNewTimeRecord(pm[0], empID, pm[2], pm[3], pm[4], pm[5], pm[6], pm[7], pm[8], pm[9], pm[10], pm[11], pm[12]);

                                              // Pass SQL Server message to e.Result so that the CallbackComplete event handler can pass it to popupcontrol label.
                                              e.Result = sMessage;
                                          }

                                  As you can see I'm passing the returned message to e.Result. When I put a breakpoint at e.Result = sMessage, I do in fact see my message.

                                  However, when I apply the following javascript code to the CallbackComplete eventhandler (see attached screenshot):

                                  function(s, e) {
                                      document.getElementById('clientLabel').innerHTML = e.result;
                                  }

                                  Nothing appears on my popupcontrol in clientLabel!

                                  What am I doing wrong?

                                  Peter

                                • If you wish to display a text in ASPxLabel, I recommend you initialize the ClientInstanceName property and use its value on the client side to get the control client-side instance. After that, call the ASPxClientLabel.SetText method to set the text.

                                • Peter Costantino 07.10.2012

                                  When you say "initialize the ClientInstanceName property", do you mean give it a name via code? or via setting the property to a name. I've done the latter, that is I've given it a name already, which is 'clientLabel'.

                                  Secondly, I've tried to assign the SQL message by using either EndCallback or CallbackComplete client-side eventhandlers. I'm using the following statement:

                                  function(s, e) {
                                       clientLabel.SetText(e.Result);
                                  }

                                  Neither of them work!

                                • Hello,

                                  It is necessary to specify the control's ClientInstanceName property at either design or run time to be able to manipulate our control on the client side:
                                  Client-Side Functionality
                                  Please take a look at the E2379 - ASPxGridView - How to update an external control during a callback Code Central example that illustrates the recommended way for accomplishing this task:

                                  <dx:ASPxLabel ... ClientInstanceName="clientLabel">
                                  </dx:ASPxLabel>
                                  
                                • Peter Costantino 07.11.2012

                                  Mike

                                  I've already done that. It still doesn't show the message. :(

                                  Peter

                                • Peter Costantino 07.11.2012

                                  My suspicion is that the CallbackComplete clientside event isn't being called. What calls this event if the procedure runs?

                                  Peter

                                • Hi Peter,

                                  This issue can be caused by the fact that you are sending a postback after a callback. Please refer to the The CallbackComplete event of the ASPxCallback is never being raised. thread where a similar issue was discussed.

                                  If it does not help, please send us your code snippets, or provide us with a simple working project that illustrates the issue in action. With a small example project, it is much easier for us to verify that the code that calls ours is valid, and that the way our controls are being used is recommended. This way, we can concentrate our resources on the problematic area:
                                  A request for simple example programs
                                  Your time and cooperation are greatly appreciated.

                                • Peter Costantino 07.11.2012

                                  Well, that was the problem! I had to switch the AutoPostBack property of the ASPxButton on the popupcontrol to allow the CallbackComplete clientside event to allow the message to appear finally! Thank you very much for your assistance!

                                  Peter

                                • Thank you for informing us that the problem has been resolved. We are glad that our assistance was helpful.
                                  If you need any further assistance with this subject, please feel free to post a new reply/comment.

                                You must  log in  or  register  to leave comments
                                You must  log in  or  register  to leave an answer

                                Is your intention to post an answer to your own question?

                                • If so, then proceed.
                                • If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
                                • If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.