Tag: asp.net

我可以在Web应用程序中使用Awesomeium吗?

我正在尝试渲染一个html代码,将其导出到一个图像,然后使用该图像将其放入pdf文档中。 我正在使用asp.net/C# Web应用程序。 我遇到的问题是,当我不止一次这样做时,它会给我这个错误: You are attempting to re-initialize the WebCore. The WebCore must only be initialized once per process and must be shut down only when the process exits. 这是我的代码: WebCore.Initialize(new WebConfig(), false); using (WebView webView = WebCore.CreateWebView((pdfWidth – 80).ToString().ToInt() + 20, (pdfHeight / 2).ToString().ToInt() + 20)) { webView.LoadHTML(html); while (webView.IsLoading || !webView.IsDocumentReady) WebCore.Update(); […]

在asp.net中inheritance问题

在我的Web应用程序中,我将其他站点的代码复制并粘贴到我的页面中,当我运行应用程序时,它的源代码开始forms就是这样的错误 ‘/ DomainIV’应用程序中的服务器错误。 编译错误说明:在编译为此请求提供服务所需的资源期间发生错误。 请查看以下特定错误详细信息并相应地修改源代码。 编译器错误消息:ASPNET:确保此代码文件中定义的类与’inherits’属性匹配,并且它扩展了正确的基类(例如Page或UserControl)。 来源错误: 第1行:使用系统; 第2行:使用System.Data; 第3行:使用System.Web; 源文件:c:\ Inetpub \ wwwroot \ DomainIV \ WhoIs.aspx.cs行:1 这是我的问题,请帮助我谢谢你。

MVC4将模型绑定到ICollection或List in partial

给定一个模型 public class Task { public int TaskId { get; set; } public string Title { get; set; } public ICollection Information { get; set; } } 哪里 public class SomeData { public int SomeDataId { get; set; } public string Description { get; set; } } 我有一个观点 @model myProject.Models.Task @Html.LabelFor(model => model.Title) @Html.Partial(“_InformationEdit”, Model.Information.ToList(), […]

ASP.Net OAuth授权服务器:添加一个数组作为附加响应参数

我已经实现了一个自定义的OAuthAuthorizationServerProvider ,我希望在我的客户端请求访问令牌时在响应中添加一些其他元素。 为此,我重写了OAuthAuthorizationServerProvider.TokenEndpoint方法,并成功设法添加了一些单个元素(通过将它们添加到context.AdditionalResponseParameters字典中)。 现在我有这样的回应: { “access_token”: “wxoCtLSdPXNW9KK09PVhSqYho…”, “token_type”: “bearer”, “expires_in”: 1199, “refresh_token”: “uk0kFyj4Q2OufWKt4IzWQHlj…”, “toto”: “bloblo”, “tata”: “blabla” } 这很棒,但我的目标是添加一个数组以获得这种响应: { “access_token”: “wxoCtLSdPXNW9KK09PVhSqYho…”, “token_type”: “bearer”, “expires_in”: 1199, “refresh_token”: “uk0kFyj4Q2OufWKt4IzWQHlj…”, “scopes”: [“read”, “write”] } 我试图添加一个json解析的列表或数组而不是一个简单的字符串,但它给了我 “scopes”: “[\”read\”,\”write\”]” 这是解析为Json的字符串,而不是Json数组:/ 如何在TokenEndpoint响应中添加Json数组?

DropdownList.selectedIndex总是0(是的,我确实有!isPostBack)

(向下滚动到post底部以找到解决方案。) 有一个包含Datalist的asp.net页面。 在这个数据列表中,有一个包含下拉列表的模板,每次数据列表中都填充了一个项目,就会调用一个ItemCreatedCommand。 itemCreatedCommand负责数据绑定下拉列表。 我认为问题出在这里,我正在使用ItemCreatedCommand填充它 – 但奇怪的是,如果我选择颜色“绿色”,页面将自动回复,我会看到下拉列表仍然是绿色,但在尝试使用它的SelectedIndex时,我总是得到0 …… protected void DataListProducts_ItemCreatedCommand(object source, DataListItemEventArgs e) var itemId = (String)DataListProducts.DataKeys[e.Item.ItemIndex]; var item = itemBLL.GetFullItem(itemId); var DropDownListColor = (DropDownList)e.Item.FindControl(“DropDownListColor”); //Also tried with : //if(!isPostBack) { DropDownListColor.DataSource = item.ColorList; DropDownList.Color.Databind(); // } End !isPostBack) Label1.test = DropDownListColor.SelectedIndex.toString(); // <- THIS IS ALWAYS 0! *grr* 我已经缩小了代码以供查看,但是你仍然可以看到我正在尝试做什么:)之所以我这样做,而不是直接为aspx-page声明颜色的数据源,是因为我需要运行一个测试if(showColors),但是我不想把代码放在html页面上,我认为应该在代码后面的文件中。 编辑:在尝试改变SelectedIndexChange之后 – 我现在脑子里有一个“逻辑”混乱 – […]

LINQ表达式转换/从Int到String的Concat

我想用Concat两个表达式作为最终表达式 Expression<Func> 所以我创建了表达式belwo代码只适用于字符串类型,如果我将memberExpression作为Int32或DateTime抛出exception 类型’System.Int32’的表达式不能用于方法’System.String Concat(System.String,System.String)’的’System.String’类型的参数 如果我将表达式转换为 var conversion = Expression.Convert(memberExpression, typeof (string)); 获取没有强制运算符是在类型’System.Int32’和’System.String’之间定义的。 请帮我解决 码 MethodInfo bodyContactMethod = typeof (string).GetMethod(“Concat”,new[] {typeof (string), typeof (string)}); ParameterExpression parameter = Expression.Parameter(typeof (T)); body = Expression.Call(bodyContactMethod, cons, memberExpression); return Expression.Lambda<Func>(body, parameter);

如何在详细视图中为命令字段添加删除确认提示?

我想在用户尝试删除详细视图中的记录时提示用户进行确认? 我有命令提交showDeletebutton设置为true。 我找到了如何对gridview进行确认,但是如何修改以匹配详细视图? 码: protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { // loop all data rows foreach (DataControlFieldCell cell in e.Row.Cells) { // check all cells in one row foreach (Control control in cell.Controls) { // Must use LinkButton here instead of ImageButton // if you are having Links (not […]

ASP.NET Forms自动保存

我们有一个内部的asp.net表单应用程序,其中一个页面本质上是一个WYSIWYG编辑器,用户输入3-5段报告。 具有最少量用户中断的自动保存function的最佳选项是什么? 我不想每五分钟左右强制回发一次,除非我不得不这样做,而是每次文本更改时可能会进行某种类型的客户端检查,并将其与上次提交信息的时间进行比较,然后从那里?

如何在asp.net中单击按钮时动态添加控件?

我正在尝试动态添加控件 码: AddVisaControl.ascx Visa Number: Country Name: Type of Visa: Type of Entry:   Expiry Date .cs代码: 下面的代码是第一次点击添加按钮时正在添加控件的问题,但如果我关闭浏览器窗口然后再次点击添加按钮我得到更多控件 static int i = 0; protected void addnewtext_Click(object sender, EventArgs e) { i++; for (int j = 0; j <= i; j++) { AddVisaControl ac = (AddVisaControl)Page.LoadControl("AddVisaControl.ascx"); PlaceHolder1.Controls.Add(ac); PlaceHolder1.Controls.Add(new LiteralControl("”)); } } 在下面的图像如果我点击添加更多签证按钮我想获得另一个签证详细信息 有任何想法吗? 提前致谢

在asp.net中弹出窗口?

如何在asp.net-C#的弹出窗口中显示我的消息? 我很酷的javascript! 有没有与c#相关的想法?