简体   繁体   English

成员定义不止一次

[英]Member defined more than once

I am new to the whole get and set thing, but this seems pretty straightforward, don't I set something but just calling this.Var = value ? 我是整个获取和设置事物的新手,但这似乎很简单,我不设置任何东西,而只是调用this.Var = value

public LoginView LoginView1 { get; set; }

void Page_Load(Object sender, EventArgs e)
{
    this.LoginView1 = (LoginView)FindControls.FindControlRecursive(Page, "LoginView1"); 
    RadGrid RadGrid3 = (RadGrid)LoginView1.FindControl("RadGrid3");
    RadGrid RadGrid4 = (RadGrid)LoginView1.FindControl("RadGrid4");
    UpdatePanel UpdatePanel1 = (UpdatePanel)LoginView1.FindControl("UpdatePanel1");
    LoadData();
}

My error is saying that LoginView1 is defined more than once. 我的错误是说LoginView1被定义了多次。 All I want to do is set the global variable on Page Load. 我要做的只是在Page Load上设置全局变量。

You'll have it on the page itself, which means it is in the designer.cs file too, which means there is indeed a LoginView1 already defined, for the login view you are trying to get. 您将在页面本身上拥有它,这意味着它也位于designer.cs文件中,这意味着确实已经为要获取的登录视图定义了LoginView1

Call it something else. 叫别的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM