﻿
{"id":1295,"date":"2013-01-23T01:09:52","date_gmt":"2013-01-23T01:09:52","guid":{"rendered":"http:\/\/www.gencayyildiz.com\/blog\/?p=1295"},"modified":"2013-01-23T01:09:52","modified_gmt":"2013-01-23T01:09:52","slug":"asp-net-mvcde-html-kontrollerinin-degerine-ulasma","status":"publish","type":"post","link":"https:\/\/www.gencayyildiz.com\/blog\/asp-net-mvcde-html-kontrollerinin-degerine-ulasma\/","title":{"rendered":"Asp.NET MVC&#8217;de Html Kontrollerinin De\u011ferine Ula\u015fma"},"content":{"rendered":"<div id=\"fb-root\"><\/div>\n<p>MVC \u00fczerine \u00e7al\u0131\u015fmalar\u0131m s\u0131ras\u0131nda Model&#8217;i tan\u0131mlanmam\u0131\u015f View katman\u0131 \u00fczerinde, HTML kontrollerine girilen verilerle POST i\u015flemi yapmak benim i\u00e7in oldukca can s\u0131k\u0131c\u0131 bir hal ald\u0131.\u00c7\u00fcnk\u00fc HTML kontrollerine nas\u0131l ula\u015fabilece\u011fimi bir t\u00fcrl\u00fc bulamad\u0131m ve haliyle \u00fczerlerinde ta\u015f\u0131d\u0131klar\u0131 de\u011ferlere ula\u015fam\u0131yordum.Ara\u015ft\u0131rmalar\u0131m neticesinde bu i\u015fin olduk\u00e7a basit bir bi\u00e7imde yap\u0131ld\u0131\u011f\u0131n\u0131 anlad\u0131m.Beni kasan bu durumun kolay \u00e7\u00f6z\u00fcm\u00fcn\u00fc sizlere aktarmak istiyorum.<br \/>\n<!--more--><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n&lt;% using (Html.BeginForm(&quot;Ara&quot;, &quot;Bolge&quot;))\r\n   { %&gt;\r\nAra\r\n&lt;input type=&quot;text&quot; name=&quot;txtAra&quot; id=&quot;txtAra&quot; \/&gt;&lt;input type=&quot;submit&quot; name=&quot;btnAra&quot;\r\n    id=&quot;btnAra&quot; value=&quot;Ara&quot; \/&gt;\r\n&lt;%} %&gt;\r\n<\/pre>\n<p>\u00d6rne\u011fin yukar\u0131daki gibi name \u00f6zelli\u011fi &#8220;txtAra&#8221; olan &#8220;text&#8221; tipinde bir HTML nesnemiz ve bir adet &#8220;btnAra&#8221; ad\u0131nda butonumuz olsun.<br \/>\n&#8220;btnAra&#8221; isimli butona t\u0131kland\u0131\u011f\u0131 anda &#8220;Bolge(Controller)&#8221; ismindeki Controller katman\u0131m\u0131zda ki [HttpPost] Attribute&#8217;uyla i\u015faretlenmi\u015f &#8220;Ara&#8221; ismindeki Action metodumuz \u00e7al\u0131\u015facakt\u0131r.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n &#x5B;HttpPost]\r\n        public ActionResult Ara(FormCollection Nesneler)\r\n        {\r\n            string AranacakKelime = Nesneler&#x5B;&quot;txtAra&quot;];\r\n            return RedirectToAction(&quot;Index&quot;, new { AranacakKelime = AranacakKelime });\r\n        }\r\n<\/pre>\n<p>Yukar\u0131da g\u00f6rd\u00fc\u011f\u00fcn\u00fcz gibi &#8220;Ara&#8221; metodumuzun &#8220;FormCollection&#8221; tipinden &#8220;Nesneler&#8221; ad\u0131ndaki parametresi HTML kontrollerini yakalayacakt\u0131r.Bu nesne bize string tipinde bir de\u011fi\u015fken olarak HTML kontrollerini d\u00f6nece\u011fi i\u00e7in &#8220;[]&#8221; operat\u00f6r\u00fcyle &#8220;txtAra&#8221; kontrol\u00fcm\u00fcz\u00fcn de\u011ferini &#8220;AranacakKelime&#8221; ismindeki string tipteki de\u011fi\u015fkenimize atm\u0131\u015f bulunmaktay\u0131z.<\/p>\n<p>\u0130\u015fte bu kadar kolay \ud83d\ude42<br \/>\nFaydalanman\u0131z dile\u011fiyle..<\/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 \u00fczerine \u00e7al\u0131\u015fmalar\u0131m s\u0131ras\u0131nda Model&#8217;i tan\u0131mlanmam\u0131\u015f View katman\u0131 \u00fczerinde, HTML kontrollerine girilen verilerle POST i\u015flemi yapmak benim i\u00e7in oldukca can s\u0131k\u0131c\u0131 bir hal ald\u0131.\u00c7\u00fcnk\u00fc HTML kontrollerine nas\u0131l ula\u015fabilece\u011fimi bir t\u00fcrl\u00fc bulamad\u0131m ve haliyle \u00fczerlerinde&#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,289,283,335],"class_list":["post-1295","post","type-post","status-publish","format-standard","hentry","category-asp-net-mvc","tag-asp-net-mvc","tag-html","tag-mvc","tag-value"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/1295","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=1295"}],"version-history":[{"count":0,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/1295\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media?parent=1295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/categories?post=1295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/tags?post=1295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}