{"id":2379,"date":"2012-12-08T12:08:58","date_gmt":"2012-12-08T16:08:58","guid":{"rendered":"http:\/\/www.iowawebnet.com\/ein\/?p=2379"},"modified":"2012-12-07T12:09:10","modified_gmt":"2012-12-07T16:09:10","slug":"define-control-properties-in-code-behind-located-inside-gridview-or-formview","status":"publish","type":"post","link":"https:\/\/www.iowawebnet.com\/ein\/2012\/12\/define-control-properties-in-code-behind-located-inside-gridview-or-formview\/","title":{"rendered":"Define control properties in code behind located inside gridview or formview"},"content":{"rendered":"<pre>\r\nMarkup page\r\n<code>\r\n&lt;asp:FormView ID=\"DefaultPhoto\" runat=\"server\" \r\nDataKeyNames=\"ge_id\" DataSourceID=\"ListPhotosDS\">\r\n   &lt;EditItemTemplate>\r\n     &lt;img src=\"\/images\/< %# Container.DataItem(\"photo\") %>\" \r\n      class=\"detailsmallphoto\"\/>\r\n     &lt;asp:Label ID=\"photo_idLabel\" runat=\"server\" Text='< %# Eval(\"photo_id\") %>' \r\n       Visible=\"false\" \/>\r\n     &lt;asp:LinkButton ID=\"UpdateButton\" runat=\"server\" \r\n      OnClientClick=\"return confirm('Are you sure you want to remove this photo?');\" \r\n        CommandName=\"Update\" \/>\r\n   &lt;\/EditItemTemplate>\r\n&lt;\/asp:FormView>\r\n<\/code>\r\nCode behind\r\n<code>\r\nDirectCast(DefaultPhoto.FindControl(\"UpdateButton\"), LinkButton).Text = \"Remove\"\r\nIf Page.isPostBack Then\r\nDirectCast(DefaultPhoto.FindControl(\"UpdateButton\"), LinkButton).Text = \"Add Photo\"\r\nEnd If\r\n<\/code>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Markup page &lt;asp:FormView ID=&#8221;DefaultPhoto&#8221; runat=&#8221;server&#8221; DataKeyNames=&#8221;ge_id&#8221; DataSourceID=&#8221;ListPhotosDS&#8221;> &lt;EditItemTemplate> &lt;img src=&#8221;\/images\/< %# Container.DataItem(\"photo\") %>&#8221; class=&#8221;detailsmallphoto&#8221;\/> &lt;asp:Label ID=&#8221;photo_idLabel&#8221; runat=&#8221;server&#8221; Text=&#8217;< %# Eval(\"photo_id\") %>&#8216; Visible=&#8221;false&#8221; \/> &lt;asp:LinkButton ID=&#8221;UpdateButton&#8221; runat=&#8221;server&#8221; OnClientClick=&#8221;return confirm(&#8216;Are you sure you want to remove this photo?&#8217;);&#8221; CommandName=&#8221;Update&#8221; \/> &lt;\/EditItemTemplate> &lt;\/asp:FormView> Code behind DirectCast(DefaultPhoto.FindControl(&#8220;UpdateButton&#8221;), LinkButton).Text = &#8220;Remove&#8221; If Page.isPostBack Then DirectCast(DefaultPhoto.FindControl(&#8220;UpdateButton&#8221;), LinkButton).Text = &#8220;Add Photo&#8221; End [&hellip;]<\/p>\n","protected":false},"author":35,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[85,17,16,52,84],"tags":[19,144,42,21],"class_list":["post-2379","post","type-post","status-publish","format-standard","hentry","category-net-4-0","category-applications","category-net","category-controls","category-vs2010","tag-asp-net","tag-controls","tag-gridview","tag-visual-studio"],"_links":{"self":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/2379"}],"collection":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/users\/35"}],"replies":[{"embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/comments?post=2379"}],"version-history":[{"count":8,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/2379\/revisions"}],"predecessor-version":[{"id":2388,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/2379\/revisions\/2388"}],"wp:attachment":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/media?parent=2379"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/categories?post=2379"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/tags?post=2379"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}