c# - Why won't my ascx file pick up my code behind properties? -


my web app solution built on top of solution. base solution meant platform multiple products. part, works fine, weird things happen when create product specific views.

i using viewusercontrol<someviewmodel> code behind class. in code behind, have access this.model , other goodies i'd expect class. in ascx file, red squiggley lines when try access this.model or other properties defined in viewusercontrol. red squiggley lines when try access properties defined directly in code behind.

what's more interesting is, don't real errors this. view renders fine @ run time , not give me build errors. ascx file thinks there errors. if create the exact same view in platform namespaces, works fine. no red squiggles.

i find annoying. it's not show stopper means, if i'm going using ide intellisense , jazz, i'd sure work properly, , pick properties supposed there.

has else run this? know of way fix this?

thanks!

edit

it requested post code. here's code behind:

namespace myproject.myproduct.web.views {     public class editsearch : viewusercontrol<searchresultsviewmodel>     {         public bool issearchtypea()         {             ...............         }          public bool issearchtypeb()         {             ...............         }     } } 

and here's ascx:

<%      if (!this.issearchtypeb())     {          string categorypagetitle = this.model.searchwidgetparameters.search.categorypagetitle;         string categorypageurl = this.model.searchwidgetparameters.search.filters.categorypageurl;          if (!string.isnullorempty(categorypageurl))         {             %> <div id="coid_website_backtocategorypagelink"> <%              string tocguid = this.model.searchwidgetparameters.search.filters.tocguid;              if (!string.isnullorempty(tocguid))             {                 categorypageurl += "?guid=" + tocguid;             }              var backtolink = new hyperlink();              if (this.issearchtypea())             {                 backtolink.text = "edit search";             }             else             {                 backtolink.text = "back " + translatedhtmltextwriter.translate(categorypagetitle);             }              backtolink.navigateurl = transactionoperations.addcontexttourl(categorypageurl.startswith("/browse/") ? categorypageurl : "/browse/" + categorypageurl,                                                                             websitetransitiontype.default, // requested: categorypage                                                                             transactionoperations.defaultcontextdata);             backtolink.rendercontrol(this.writer);             %>                 </div>             <%         }      } %> 

edit

for of telling me asp.net mvc cannot or not use code behind, i'm sorry horse hockey. project has existed years , there used product runs on it. product jumping onto platform. platform solution uses code behind on place, , works fine. in fact, works fine @ runtime in product's solution well, have problem ascx file doesn't seem know code behind. furthermore, viewusercontrol system.web.mvc class. still going tell me code behind isn't used in asp.net mvc?

since developing mvc cannot use code behind. instead, think adding @ top of .acsx file:

<%@ import namespace="namespace.model" %> 

then can access have in there without complication.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -