Asp.Net MVC4 Json Kullanımı

Merhabalar , uzun bir aranın ardından bir MVC4 yazısı ile karşınızdayım.

Bu yazımızda sayfa yenilenmeden Ajax ve Json aracılığı ile MVC4′de nasıl işlem yapılır bunu öğreneceğiz.

Öncelikle Visual Studio adlı program aracılığı ile bir ASP.Net MVC4 projesi açalım.

Models klasörünün içine “Deneme” adında bir class oluşturalım ve içerisine şu kodları yazalım ;

[Serializable]
    public class Uyeler
    {
        public string PageName { get; set; }
        public string PageDescriptions { get; set; }
        public bool Ekle(Uyeler uye)
        {
            bool sonuc = false;
// bu kısma yapmak istediğiniz işlemi yazabilirsiniz.
            return sonuc;
        }
    }
    [Serializable]
    public class Sonuc
    {
        public string Mesaj { get; set; }
    }

Daha sonrasında “DenemeController” adında bir Controller oluşturalım.

[HttpPost]
        public ActionResult UyeKayit(Uyeler uyeler)
        {
            Uyeler uye = new Uyeler();
            uye.Ekle(uyeler);
            string bilgiler = string.Format("Adınız : {0}, Soyadınız : {1}", uyeler.PageName, uyeler.PageDescriptions);
            //return Json(new Sonuc() { Mesaj = bilgiler });
            return Json(new Sonuc() { Mesaj = "İşleminiz Başarı İle Gerçekleşmiştir" });
        }
DenemeController‘in Index sayfasına yani View kısmına bunu yazalım ;

 

<script type="text/javascript">
        $(function () {
            $("#uyeKayit").click(function () {
                var gelen = Veriler();
                var jsonData = JSON.stringify(gelen);
                $.ajax({
                    url: "/Home/UyeKayit",
                    type: "Post",
                    data: jsonData,
                    dataType: "json",
                    contentType: "application/json; charset=utf-8",
                    success: function (data) {
                        var sonuc = data.Mesaj;
                        $("#Sonuclar").html(sonuc);
                    }
                })
            });
        });

        function Veriler() {
            var PageName = $("#pagename").val();
            var PageDescriptions = $("#pagedescriptions").val();
            return (PageName == "") ? null : { pagename: PageName, pagedescriptions: PageDescriptions };
        }
    </script>
    <h2>
        Mvc 3 ile Json Veri Gönderimi</h2>
    <div style="font-family: Verdana; font-size: 12px;">
        <div style="padding: 15px 0;">
            <span id="Sonuclar"></span>
        </div>
        <div style="padding: 5px 0;">
            Sayfa Adı</div>
        <div>
            <input type="text" id="pagename" />
        </div>
        <div style="padding: 5px 0;">
            İçerik</div>
        <div>
            <input type="text" id="pagedescriptions" />
        </div>
        <div>
            <input type="submit" value="gönder" id="uyeKayit" />
        </div>
    </div>

Örnek uygulamayı buradan indirebilirsiniz.

Continue Reading

The Main An Nfl Lockout Can Impact One s Enthusiasm To This Game

My classmates and i also bought wholesale hockey jerseys online. We had Taylor Graham and Roger Levesque from the Seattle Sounders FC, improve the opening of the shop which was a wonderful occasion. Not only did the Rams only positioned 10 total points, they failed to get twice amongst people from Miami’s (OH) two yard tier.

wholesale jerseys

Scott has some talent and was an extensive selection in round half a year. Michael Bennett was rescued from crowded Saints backfield to spell Johnson but despite unlimited potential, he’s never been rrn a position to stay healthy at Wisconsin or with the Vikes and in all likelihood not considerably as the rigors of an nfl period. If you’ve always wanted dog clothes for canine but you want something above what silly, cutesy outfits, then pooch gear that shows your MLB loyalty the the perfect choice. So canine needs something great to wear to the game? If i were local I’d return but there is little beckoning me back during this time.

wholesale jerseys China

Most of your mlb picks succeed, your payout on the 6 to one (for three out of three) and as high as 320 to one (for nine out of nine). This could be a fantastic gift for a birthday or holiday or possibly to set off the wholesale jerseys new baseball season with preferences. They even returned cheap jerseys China subsequent year towards the title game but lost in the rematch. I think you will embrace that responsibility and run as well as. Dimitri Patterson-CB- Dimitri has improved his play and is defined as becoming better each period of time.

Ole Miss was No Southern Miss No and Mississippi State No A particular pitcher on the good team will win 18 or even more games from a season and lose merely a handful. Some eye ware may wrap around the wats or temples. Perhaps you can hold it at the local football field.

Sport is in existence for countless of as well as has been an essential part for the lives a lot of people all over the place. Sports Basket – For your sports enthusiast, a sports basket is ideal. Turn on your computer and hook to the Web.

Unless you’re looking to start trouble, it’s best to leave the jerseys of these polarizing players in your closet. Joe Pavelski C jersey Former Texas Ranger Mark McLemore will be on hand at Brown-Lupton stadium tonight in Fort Worth to sign autographs and throw the actual ceremonial first pitch. If Washington had even above average special teams, or less prestigiously good kickers, that average record may closer to 9-7, and instead of earning the playoffs three times in 12 seasons, they might have likely made it at least every other year. NaVorro Bowman made his first appearance in practice at OTAs this week and he stated it feels good to get back with the team. Mirroring the mid-90s Chicago Bulls of the NBA, college pigskin became a veritable one-team league from 1994 to 1995.

A childhood run-in by using a motorcycle damaged his left arm and collarbone. How about the 8-3 Jets who were on their way towards the Super wholesale jerseys China Pan? Inside the other hand, if the c’s has a -120, handful of basic to risk one hundred twenty dollars to win cheap NHL jerseys,wholesale jerseys,cheap jerseys from China one hundreds.

Ideas To Get Kids Halloween Party

Hello world!

Continue Reading