﻿
{"id":1021,"date":"2012-11-24T00:09:43","date_gmt":"2012-11-24T00:09:43","guid":{"rendered":"http:\/\/www.gencayyildiz.com\/blog\/?p=1021"},"modified":"2012-11-24T00:09:43","modified_gmt":"2012-11-24T00:09:43","slug":"mvcde-viewdata-kullanimi","status":"publish","type":"post","link":"https:\/\/www.gencayyildiz.com\/blog\/mvcde-viewdata-kullanimi\/","title":{"rendered":"MVC&#8217;de ViewData Kullan\u0131m\u0131"},"content":{"rendered":"<div id=\"fb-root\"><\/div>\n<p>MVC teknolojisinin \u00f6nemli yap\u0131lar\u0131ndan biriside ViewData yap\u0131s\u0131d\u0131r.Controller katman\u0131ndan View katman\u0131na herhangi bir veri ta\u015f\u0131mam\u0131z\u0131 sa\u011flayan yap\u0131d\u0131r.<\/p>\n<table width=\"100%\">\n<tr>\n<td width=\"30%\">\n<strong><span style=\"color: #333300;\">ViewData<\/span><\/strong>[&#8220;<strong><span style=\"color: #ff0000;\">\u0130sim<\/span><\/strong>&#8220;] = Deger\n<\/td>\n<td>ViewData yap\u0131s\u0131 bu \u015fekildedir.\u0130sim alan\u0131na yazd\u0131\u011f\u0131m\u0131z de\u011fi\u015fken isim ile, View katman\u0131nda ViewData nesnesini \u00e7a\u011f\u0131rmaktay\u0131z.\n<\/td>\n<\/tr>\n<\/table>\n<p>Controller katman\u0131m\u0131z\u0131n herhangi bir s\u0131n\u0131f\u0131ndaki ActionResult tipinden metodumuzda a\u015fa\u011f\u0131daki \u015fekilde kullan\u0131larak, View katman\u0131na veriyi g\u00f6ndermektedir.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\u00a0 \u00a0 \u00a0 \u00a0 public ActionResult Index()\r\n\u00a0 \u00a0 \u00a0 \u00a0 {\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 ViewData&#x5B;&quot;Deger&quot;] = &quot;Gen\u00e7ay Y\u0131ld\u0131z&quot;;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 return View();\r\n\u00a0 \u00a0 \u00a0 \u00a0 }\r\n<\/pre>\n<p>View katman\u0131nda ise, &#8220;Deger&#8221; de\u011fi\u015fken ad\u0131ndaki ViewData nesnesinin tuttu\u011fu de\u011fere bu \u015fekilde ula\u015fabiliriz.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n&lt;%: ViewData&#x5B;&quot;Deger&quot;] %&gt;\r\n<\/pre>\n<p>\u015eu hususada de\u011finmekte fayda var.&#8221;<%: %>&#8221; yap\u0131s\u0131nda iki nokta \u00fcst \u00fcste kulland\u0131\u011f\u0131m\u0131z dikkatinizi \u00e7ekmi\u015ftir.Halbuki &#8220;:&#8221; yerine &#8220;=&#8221;(e\u015fittir) i\u015faretide kullanabiliriz.Aralar\u0131ndaki fark\u0131 sorarsan\u0131z e\u011fer, &#8220;:&#8221; html, javascript gibi komutlar\u0131 oldu\u011fu gibi yazarken, &#8220;=&#8221; bu komutlar\u0131 i\u015fleyip sonucunu yans\u0131tmaktad\u0131r.<\/p>\n<p>Bu yaz\u0131m\u0131z\u0131nda sonuna gelmi\u015f bulunmaktay\u0131z.<br \/>\nBir sonraki yaz\u0131mda g\u00f6r\u00fc\u015fmek \u00fczere&#8230;<br \/>\n\u0130yi \u00e7al\u0131\u015fmalar..<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>MVC teknolojisinin \u00f6nemli yap\u0131lar\u0131ndan biriside ViewData yap\u0131s\u0131d\u0131r.Controller katman\u0131ndan View katman\u0131na herhangi bir veri ta\u015f\u0131mam\u0131z\u0131 sa\u011flayan yap\u0131d\u0131r. ViewData[&#8220;\u0130sim&#8220;] = Deger ViewData yap\u0131s\u0131 bu \u015fekildedir.\u0130sim alan\u0131na yazd\u0131\u011f\u0131m\u0131z de\u011fi\u015fken isim ile, View katman\u0131nda ViewData nesnesini \u00e7a\u011f\u0131rmaktay\u0131z. Controller&#46;&#46;&#46;<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[746,283,291],"class_list":["post-1021","post","type-post","status-publish","format-standard","hentry","category-asp-net-mvc","tag-asp-net-mvc","tag-mvc","tag-viewdata"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/1021","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/comments?post=1021"}],"version-history":[{"count":0,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/1021\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media?parent=1021"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/categories?post=1021"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/tags?post=1021"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}