CS0120: An object reference is required for the nonstatic field, method, or property 'foo'

前端 未结 7 1113
挽巷
挽巷 2020-11-21 04:34

Consider:

namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            


        
相关标签:
7条回答
  • 2020-11-21 05:31

    I actually got this error because I was checking InnerHtml for some content that was generated dynamically - i.e. a control that is runat=server.

    To solve this I had to remove the "static" keyword on my method, and it ran fine.

    0 讨论(0)
提交回复
热议问题