我遇到問題。 我重命名此Web窗體後,我得到此錯誤,但我將所有更改爲新名稱 但我得到此錯誤。 Plz,幫助。 代碼:擴展方法必須在非泛型靜態類中定義
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class bVoteAnswer : System.Web.UI.Page
{
UserVotes ue = new UserVotes();
bVotes bv = new bVotes();
bVoteAnswers ve = new bVoteAnswers();
public void Page_Load(object sender, EventArgs e)
{
dropdownlist.Enabled = false;
int BuildingId = Convert.ToInt32(Session["BuildingId"]);
DataTable dt = new DataTable();
dt = bv.Select(0, "", "", "", BuildingId, "",0);
Grid_Vote.DataSource = dt;
Grid_Vote.DataBind();
}
protected void Grid_Vote_RowCreated(object sender, GridViewRowEventArgs e)
{
e.Row.Cells[0].Visible = false;
}
protected void Grid_Vote_SelectedIndexChanged(object sender, EventArgs e)
{
dropdownlist.Enabled = true;
int VoteId = Convert.ToInt32(Grid_Vote.SelectedRow.Cells[0].Text);
DataTable dt = new DataTable();
dt = ve.Select(0,VoteId,"");
for (int i = 0; i <= dt.Rows.Count; i++)
{
ListItem l = new ListItem(dt.Rows[i][2].ToString(), dt.Rows[i][2].ToString());
dropdownlist.Items.Add(l);
}
}
protected void btn_insert_Click(object sender, EventArgs e)
{
int OwnerId = Convert.ToInt32(Session["OwnerId"]);
int VoteId = Convert.ToInt32(Grid_Vote.SelectedRow.Cells[0].Text);
DataTable dt = new DataTable();
dt = ve.Select(0, VoteId, dropdownlist.SelectedValue);
int AnswerId = Convert.ToInt32(dt.Rows[0][0]);
DateTime ClientDateTime = DateTime.Now;
string PersianDate = GetPersianDate(ClientDateTime);
ue.Insert(0, VoteId, OwnerId, AnswerId, PersianDate);
}
public static string GetPersianDate(this DateTime date)
{
PersianCalendar jc = new PersianCalendar();
return string.Format("{0:0000}/{1:00}/{2:00}", jc.GetYear(date), jc.GetMonth(date), jc.GetDayOfMonth(date));
}
}
我將名稱更改爲第一個名字,但錯誤顯示 我想是不是一個錯誤和Visual Studio不要運行神
在想,如果這是你自己,或者是錯誤的編譯器,這是非常經常自己。 –