我需要在类库项目中使用System.Web.UI.
using System.Web.UI;
namespace OnlinePdViewer
{
public class DisplayPd
{
}
}
Run Code Online (Sandbox Code Playgroud)
使用System.Web.UI语句时出现编译错误:
"'System.Web'中的命名空间中不存在类型或命名空间名称'UI',您是否缺少程序集引用?"
我试图添加引用System.Web,但COM不包括System.Web DLL.
你能帮我搞清楚吗?谢谢..
c# asp.net namespaces system.web.ui.webcontrols visual-studio-2013
HttpContext.Current.ApplicationInstance.CompleteRequest似乎什么都不做.我错过了什么?
例如,尽管在每个有趣的事件期间都调用了CompleteRequest,但以下所有事件仍然在一个简单的测试页面上运行.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
namespace LifeCycle
{
public partial class _Default_NoMasterPage : System.Web.UI.Page
{
private int count = 0;
protected override void OnInit(EventArgs e)
{
nextLabel("InitBeforeBase");
base.OnInit(e);
HttpContext.Current.ApplicationInstance.CompleteRequest();
nextLabel("Init");
}
protected override void OnInitComplete(EventArgs e)
{
nextLabel("InitCompleteBeforeBase");
base.OnInitComplete(e);
HttpContext.Current.ApplicationInstance.CompleteRequest();
nextLabel("InitComplete");
}
protected override void OnLoad(EventArgs e)
{
nextLabel("OnLoadBeforeBase");
base.OnLoad(e);
HttpContext.Current.ApplicationInstance.CompleteRequest();
nextLabel("OnLoad");
}
protected override void OnLoadComplete(EventArgs e)
{
nextLabel("OnLoadCompleteBeforeBase");
base.OnLoadComplete(e);
HttpContext.Current.ApplicationInstance.CompleteRequest();
nextLabel("OnLoadComplete");
}
protected override void OnPreInit(EventArgs e) …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 System.Web.UI.WebControls.ListItems 的 Collections.Generic.List 对 asp:DropDownList 进行数据绑定。DataBind() 抛出此错误。
System.ArgumentOutOfRangeException: 'ddlPlatinumOptions' 有一个无效的 SelectedValue,因为它不存在于项目列表中。
.ascx
<asp:DropDownList ID="ddlPlatinumOptions" runat="server" AutoPostBack="true" width="100%"></asp:DropDownList>
Run Code Online (Sandbox Code Playgroud)
.ascx.cs
public void BindPlatinumOptions()
{
ddlPlatinumOptions.DataTextField = "Text";
ddlPlatinumOptions.DataValueField = "Value";
ddlPlatinumOptions.DataSource = _platinumOptions;
ddlPlatinumOptions.DataBind(); // Throwing Error
}
Run Code Online (Sandbox Code Playgroud)
主持人
MattressProtectionInfo standard = RF_ProtectionPlan.GetMattressPlanInfo(MattressId, false);
MattressProtectionInfo premium = RF_ProtectionPlan.GetMattressPlanInfo(MattressId, true);
List<ListItem> plans = new List<ListItem>();
if (standard != null)
{
plans.Add(new ListItem(standard.Price.ToString("C") + " - Standard 5-Year Platinum Protection", standard.ProductID.ToString()));
}
if (premium != null)
{
plans.Add(new ListItem(premium.Price.ToString("C") + " - Premium …Run Code Online (Sandbox Code Playgroud)