Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7071515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:41:49+00:00 2026-05-28T05:41:49+00:00

I have my page where i have ajax call to display form. My code

  • 0

I have my page where i have ajax call to display form.
My code works when the register the code for form but not from postback (validation error in controller).
any idea how to fix this?

My container page has:

Scripts:

<%= Html.JQuery() %>
     <script src="../../../../Scripts/jquery.ui.core.js" type="text/javascript"></script>
     <script src="../../../../Scripts/jquery.ui.datepicker.min.js" type="text/javascript"></script>
     <script src="../../../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
     <script src="../../../../Scripts/MicrosoftMvcAjax.js" type="text/javascript">/script>
     <script src="../../../../Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script>
     <script type="text/javascript">
       function registerStuff() {
             //this gets triggered when onsuccess is called
             $("#date").datepicker({ dateFormat: 'dd/mm/yy' });
             $("#sla").datepicker();
         }

     </script>

Content:

 <%= Ajax.AjaxButton("New action", "CreateWorkFlowAction", new {
 controller = "CaseWorkFlow" }, new AjaxOptions() { UpdateTargetId =
 "divTableContainer", HttpMethod = "Get", OnSuccess =
 "registerStuff"})%>

      <div id="divTableContainer">
response will appear here
</div>

my form looks like

<script type="text/javascript">
    function RegisterJs() {
        $("#date").datepicker({ dateFormat: 'dd/mm/yy' });
        $("#sla").datepicker({ dateFormat: 'dd/mm/yy' });
    }
</script>
<% Html.EnableClientValidation(); %>
<% using (Ajax.BeginForm("CreateWorkFlowAction", new AjaxOptions() { UpdateTargetId = "divTableContainer", HttpMethod = "Post" }))
   {%>
<%= Html.ValidationSummary() %>

<fieldset>
    <div>
        <label for="title">
            Title</label>
        <%= Html.TextBoxFor(x=>x.Title) %>
    </div>
    <div>
        <label for="SLA">
            SLA(Due Date)</label>
        <%= Html.TextBoxFor(x => x.SelectSlaDate, new { id = "sla", @Value = string.Empty} )%>
    </div>
    <div>
        <label for="date">
            Date</label>
        <%= Html.TextBoxFor(x => x.SelectDate, new { id = "date", @Value = string.Empty})%>
    </div>
    <div>
        <button type="submit">Save action</button> 
    </div>
</fieldset>
<% } %>

the problem is

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:41:50+00:00Added an answer on May 28, 2026 at 5:41 am

    i have found the solution to my question.

    I have to reregister my javascript inside of a partial view.

    this means that i had to update add register scripts into the parent page to which i will insert partial view.

    and therfore if my view page contains partial view i had to move

       function registerStuff() { 
                 //this gets triggered when onsuccess is called 
                 $("#date").datepicker({ dateFormat: 'dd/mm/yy' }); 
                 $("#sla").datepicker(); 
             } 
    

    to the index page.
    After on success call this function “registerStuff” from my oncomplete,
    and after then everything is working like charm

    hope this helps to you too

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On my main page I have this jquery code which does an ajax call
I have a button on my page. When clicked it triggers an ajax call
I have an HTML page that uses AJAX to retrieve messages from a server.
I have a page that has several ajax submission forms. Each form has a
I have an AJAX call which loads an Dialog page, now depending upon the
Im using the following ajax code to submit data from a form to a
Im using jquery to call a page via ajax. I have some jquery functions
I have an ajax call to one php script via jquery but it takes
I have a codeigniter application.In that i call the controller function using ajax/jquery.But when
I am posting data from one ASP.NET page to another via jQuery ajax call

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.