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

Refresh/Postback Custom Advanced Form

2 Answers 96 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
IT Support
Top achievements
Rank 1
IT Support asked on 02 Oct 2012, 02:52 PM

I have set up a custom attribute "CustNo" on the standard AdvancedFormVB.ascx to hold a customer number. This is all working perfectly, and anything I type into this custom attribute's textbox is correctly saving to the database along with the appointment information, and is later being retrieved correctly when I reopen the appointment.

I am opening a RadWindow from a button on my AdvanceFormVB.ascx so that my users can create a customer record.
From my RadWindow's code behind I am:
1. Saving the newly created customer record to my database.
2. Storing the ID (Customer Number) of the newly created record in to a session variable.
3. Calling a clientside javascript function to close the Radwindow.

I have been able to verify from a javascript alert window that after the RadWindow closes my session variable still contains the correct ID (Customer Number).

What I would like to be able to do is, when the RadWindow closes,
1. put this ID straight into the "CustNo" Attribute Textbox of the still open AdvancedForm.
2. Call a refresh/postback of the AdvancedFormVB so that I can do some additional display stuff.

I'm assuming that populating the custom attribute textbox and calling a postback on the AdvancedForm must be done using javascript/jquery? But I'm a javascript/jquery newbie and have no idea how to go about it.



2 Answers, 1 is accepted

Sort by
0
IT Support
Top achievements
Rank 1
answered on 03 Oct 2012, 10:46 AM
I think I solved my own problem. This was a lot easier than I thought.

On the RadWindowManager I call a javascript function OnClientClose="OnClientClose"
On the same page as the RadWindowManager I added the following javascript function which postbacks the Advanced Form:

function OnClientClose(oWnd, args) {
        __doPostBack('', '');

 

}

And then in the AdvancedFormVB.ascx.vb Page_Load I check to see if my session variable (which I set in my popup customer maintenance and search screen) is set and populate the necessary textbox / panels as appropriate e.g. :

 

If Not Session("returnedValues") Is Nothing Then

  Dim results As Stack = DirectCast(Session("returnedValues"), Stack)

  While results.Count > 0
     
   SubjectText.Text += results.Pop()
   End While

End If

 

You may only want to refresh the Advanced Form if someone selected something in your modal popup rather than just closed it, in which case you can check for arguments before doing the postback:

function OnClientClose(oWnd, args) {
    var arg = args.get_argument();
    if (arg) { 
        __doPostBack('', '');
    }

}

You would of course need to set these arguments in your modal popup program e.g:

function
returnToParent() {
  //create the argument that will be returned to the parent page

 

    var oArg = new Object();

    oArg.customer = '<%= Session("returnedValues") %>';

    var oWnd = GetRadWindow();

    oWnd.close(oArg);

 }

Hope this helps others.

0
Arlety
Top achievements
Rank 1
answered on 03 Jan 2013, 04:54 PM
Thank you!!!
Tags
Scheduler
Asked by
IT Support
Top achievements
Rank 1
Answers by
IT Support
Top achievements
Rank 1
Arlety
Top achievements
Rank 1
Share this question
or