Sunday 15 March 2015

javascript - Posting to Popup Controller Before the Parent Page Controller -


How do I apply a popup page to post my controller before posting a controller? The popup page is setting some session variables that will be used in the parent page. When a user double-clicks the grid on a pop-up page, he goes directly to the controller and goes to the original controller instead.

Here is the parent where the popup is being called

  // Use the @ to open the JavaScript popup window (Html.BeginForm ("Student", " StudentPage ", FormMethod.Get, New {onsubmit =" ", id =" student "}) {// where the popup window is located}   

Here is a popup form: Using

  @using (Html.BeginForm ("index", "student information", FormMethod.Post, new {id = "StudentSearchForm"}) {@ (Html ​​.Telerik () .Grid (( IEnumerable & lt; OverrideStudent & session; session). Sessions (other student) selected. Name ("Student"). Data (keys = & gt; {keys. Update (C => C. Student ID;}) .databing (datbasing => datbasing.syser)) Columns (Columns = & gt; {columnss.Bound (p = & gt; p.StudentId). Title ("Student ID") (15) .Tantable (true). Filterable (wrong); Columns Bound (P = & Gt; P. Student Description) Title ("Description"). Withdrawal (65) .Sortable (true). Filterable (false) ); Column.Command (command = & gt; {command.Custom ("AddStudent"). Text ("Select"). DataTavell (route = & gt; {Routes.Add (o = & gt; O student ID). Route KK ("Student ID"); way. Add (O = & gt; O. Student Description) .Roots ("Scholarship"); }). Action ("student", "studentinfo"); . Html Properties (new {onclick = "PostData (this); Student SelectClick (this)"}); }) Width (20). }). Customer Events (Client = & gt; Clients .comcomplete ("On Complement") //. OnData Binding (Datadinding) //OnDatabound (OnrataDataBound ") .OnRo Selected (" Student WCLIC ")) .Sableable. (). Filtering (filtering = & gt; filtering.abled (true). Footer (true) .HtmlAttributes (new {style = "padding-right: 0.0em;"}})}}   < P> // This is the script that double-clicks:  
  function StudentDoubleClick (e) {var from Course = "@ SessionWrapper.Student.FromCoursePage" Var fromList = "@ SessionVAPER Student. ("Tr" = "" True "); $ {'(' tr ', this) .live (' dblclick ', function () {warning (" tr count = "+ count); count = count + 1; DoSearchStudent (e);}); } If (tolist == "true") {$ ('tr', this) .live ('dblclick', function) {DoSearchStudent (e);}); }} Work DoSearchStudent (e) {var row = e.row; Var studentID = row.cells [0]. WinnerHTML; Var student-description = line-seals [1]. WinnerHTML; // warning (procCodeDesc); Var data = {"Student ID": Student-ID, "Scholarship": student description, "verb": "double click"}; Var url = '@ Url.Action ("student", "studentinfo")'; $ .jax ({url: url, type: 'post', datatype: 'text', cache: wrong, async: incorrect, data: data, success: function (data) {window.top.location.href = window. Top.location.href;}, error: function (error) {warning ("an error has occurred and the window will not close");}}); }   

// This is the controller I have to go first

  Public class StudentInfoController: Controller {....... public string} Student ( String student id, string student description, string action) {if (scholarship! = Null) {Student details = httpPity.HTML code (student description); } {RedirectToAction ("AddStudent", "StudentInfo", New {StudentID = StudentID, StudentDescription = StudentDescription, action = action}); } Hold (exception e) {return "error" + e. Toasting (); } Return "Success"; }}   

After double clicking it goes directly to the controller, as a result, my variables are not being set, resulting in a futile exception.

  Public Class Student Controller: Controller {....... Public String Student (String Student ID, String Student Details, Student Student) {.......... This was a time issue when the user closes the popup window, The popup thread is not executed. At the same time, another thread starts to run, and all session variables are not set as yet, before closing the popup window, I added a delay of 1 second. SetTimeout ('StudentWindow.close ()', 1000);   

No comments:

Post a Comment