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 9215503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:13:07+00:00 2026-06-18T02:13:07+00:00

I would like to get idea about, what is the fastest and secure way

  • 0

I would like to get idea about, what is the fastest and secure way to make CRUD operations (Update-Edit-insert) in samepage with Ajax in WebMatrix Razor Syntax. Is it possible to do this CRUD Operations in same razor page with ajax without GET-POST webservice or other razor page?

I tried using jquery ajax to Post-Get data from other Razor pages with Output type Json and also using WCF Webservice. But they didnt really satisfy me, because in all i need another page to serve my data.

  • 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-06-18T02:13:08+00:00Added an answer on June 18, 2026 at 2:13 am

    Yes, you can do this. Each separate CRUD operation would have to be wrapped in its own conditional block. The condition can test to see if a particular name/value pair has been sent to the server via AJAX (e.g. action=delete or action=update). When returning values back to AJAX call, make sure that the ContentType of the Response is set correctly.

    Here’s a working example –

    @{
        if(IsAjax){
            switch(Request["action"]){
                case "create" :
                    Response.Write("You are trying to create something");
                    Response.End();
                    break;
                case "read" :
                    Response.Write("What would you like to read?");
                    Response.End();
                    break;
                case "update" :
                    Response.Write("Something is being updated");
                    Response.End();
                    break;
                case "delete" :
                    Response.Write("This is a delete");
                    Response.End();
                    break;
            }
        }
    }
    
    <!DOCTYPE html>
    
    <html lang="en">
        <head>
            <meta charset="utf-8" />
            <title></title>
            <script src="~/Scripts/jquery-1.8.3.min.js" type="text/javascript"></script>
            <script>
                $(function () {
                    $('.crud').click(function () {
                        $.get('/SinglePage/?action=' + $(this).attr('id'), function (message) {
                            alert(message);
                        })
                    })
                })
            </script>
        </head>
        <body>
            <button id="create" class="crud">Create</button>
            <button id="read" class="crud">Read</button>
            <button id="update" class="crud">Update</button>
            <button id="delete" class="crud">Delete</button>
        </body>
    </html>
    

    If anything, this illustrates how bad this approach might be in terms of maintenance etc. I would always use separate cshtml files for each data operation myself,

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

Sidebar

Related Questions

I would like to learn PHP and want to get an Idea about OOP
I would like to get some feedback on this idea, as I can see
I would like to know, if you have any idea about how to combine
I would like to get some opinions on an idea for a partial implementation
I would like to get some information about the device, os etc. from the
I would like to get numbers of comments for each posts using mysql. I
I would like to get to know how to redirect output of some program
I would like to get View instance that is used to display specific Preference
I would like to get the generic information ( Counter class) of my CounterPersistence
I would like to get rid of the close/X button on the top right

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.