HTML Element Not Recognised in Code-Behind
I just wrote this into my WebForms .aspx:
<span id="GenerateChartButton" runat="server"></span>
I went to the code-behind, and typed this:
this.GenerateChartButton
and it's not recognising that I added the span to the page. Is there something I need to do to make this happen? I have been working in MVC lately, so I haven't had to worry about the relationship between the page & code-behind in a while开发者_如何学JAVA, but I can't remember any tricks that I had to perform to reference a HTML element in my code.
Can anyone remind/inform me of what I'm not doing?
Thanks
Dave
Delete the .designer file (make a backup first) and then right click on the .aspx file and select 'Convert to Web Application'. That should make the designer file for you.
If it does not then you either have duff HTML which you need to correct first, your header line is poitning to the wrong class or a reference to a piece of code is broken.
精彩评论