Tag: c

在ASP.Net Repeater的jQuery Tooltip中显示Html内容

我有一个asp.net转发器,显示标题和图像。 图像显示基于我在转发器ItemDataBound事件中执行的一些计算。 我尝试使用jquery工具提示实现鼠标。 但我只能在工具提示中显示标题。 我想在工具提示中显示绑定到转发器的其他详细信息(errorcalls,totalcalls – 我使用这些细节在后面的代码中执行计算)。 任何人都可以帮助我做我应该做的事情吗? 我有下面的代码。 转发器代码: <h5 class="ui-widget-header" title=" “> 9 ? (Eval(“Name”) as string).Substring(0, 9) : Eval(“Name”)%> 代码背后: protected void rptMonitorSummary_OnItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { int errorcalls = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, “ErrorRatingCalls”)); int totalcalls = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, “TotalCalls”)); float Percentage = 100 – ((((float)errorcalls […]

Ajax Calender Extender无法在Asp.net Web应用程序中运行

我想使用Ajax工具包中的日历扩展程序,但它没有在目标文本框中显示。 我正在使用此代码: 然后我甚至把脚本管理器。 还有这个, 这可能是什么原因? 有帮助吗?

传递实体,从视图到控制器

在我看来,这就是我所拥有的 @foreach (var match in Model.CommonMatches) { @match.StartDateTime @match.EndDateTime @match.AvailableAttendees.Count() @Html.ActionLink(“Accept”, “AcceptAppointment”, “Appointment”, new {commonMatch = @match }) } Model.CommonMatches的类型为List public class Window { public DateTime StartDateTime { get; set; } public DateTime EndDateTime { get; set; } public IEnumerable AvailableAttendees { get; set; } } 这是从控制器传递值的方式 [HttpGet] public ActionResult ViewStatus(Guid appointmentId) { var status […]

如何从DataSet中提取JSON格式的DataTable

我正在使用Newtonsoft DLL进行序列化。 我目前正在以json格式从webmethod返回DataTable。 它工作正常。 但我希望通过返回DataSet而不是DataTable来做同样的事情。 我尝试过很多东西,但似乎都没有。 function GetDropDownData() { var myDropDownList = $(‘.myDropDownLisTId’); $.ajax({ type: “POST”, url: “test.aspx/GetDropDownDataWM”, data: ‘{name: “abc” }’, contentType: “application/json; charset=utf-8”, dataType: “json”, success: function (data) { $.each(jQuery.parseJSON(data.d), function () { myDropDownList.append($(“”).val(this[‘id’]).html(this[‘name’])); }); }, failure: function (response) { alert(response.d); } }); } function OnSuccess(response) { console.log(response.d); alert(response.d); } 返回Json DataTable: [{“name”:”sam”,”id”:”1″},{“name”:”mark”,”id”:”2″}] […]

从Code Behind打开jQuery UI对话框

我是jQuery和JavaScript的新手,我遇到了一个问题。 我在Gridview中从ButtonField打开jQuery UI对话框时遇到一些问题: 起初我尝试给上面的一个类并将其命名为sliderPopupOpener,并在单击时打开jQuery Popup,如下所示: $(“.sliderPopupOpener”).click(function () { $(“#sliderPopup”).dialog(“open”); }); 然而,由于回发,这不起作用,除此之外,它也不适用于我的方法。 因为我想在显示jQuery UI对话框之前从数据库中获取一些数据。 所以我认为最好的方法是从Code Behind调用Dialog函数。 我怎样才能做到这一点? 我试过这种方法,但它不起作用,我不确定我做错了什么。 if (e.CommandName == “modifyDeadline”) { string sliderPopupFunction = @” $(function () { jQuery(function () { $(“”#sliderPopup””).dialog(“”open””); } }); “; ClientScript.RegisterStartupScript(typeof(Page), “key”, sliderPopupFunction); } 以上可能吗? 如果是这样,我做错了什么? 编辑: 我注意到每个人都在解决这个问题,而不是通过从Code Behind调用jQuery函数来告诉我这是否可行。 虽然我很欣赏其他解决方案,但如果我能通过背后的代码尽可能少地工作,我将不胜感激,因为我已经准备好了这一切。

mvc 4底部的脚本 – 不在View页面中执行

在MVC4 ,Views在页面底部包含script元素。 例如。 在_layout.cshtml (在“ Shared文件夹”下)中, 标记位于最底部。 虽然我知道这会使页面加载速度更快,但问题实际上是这样的: 在我的Views ,有时我碰巧使用一些脚本,如autocomplete ,如下所示: …… 这是不起作用的,因为scripts标记包含在页面的最末端。 (当时甚至没有加载JQuery) 痛苦地说,我不得不将Script Bundle rendering移到页面顶部。 喜欢, render jquery first then load scripts 所以,我错过了什么,或者我应该始终将我的scripts标记保存在_layout.cshtml页面的顶部? 谢谢你的回复。

使用jQuery将HTML表导出为MS Excel格式

我试着效仿这个例子 。 使用jQuery将HTML表导出为MS Excel格式。 这是我的.aspx: .js(JScript2.js): $(“#btnExport”).click(function (e) { window.open(‘data:application/vnd.ms-excel,’ + $(‘#tbl’).html()); e.preventDefault(); }); ……以及代码隐藏: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class JQuery_Export_To_Excel : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { TableRow tr = new TableRow(); TableCell tc = new TableCell(); tc.Text = “AAA”; tr.Cells.Add(tc); […]

ASP.NET与jQuery DatePicker

我想做这样的事情: http : //jqueryui.com/datepicker/ 但是,我不确定如何: 我有一个母版页内容页面,当我尝试复制该代码并将其粘贴到内容页面时,它会说“XXXX不能在内容区域”。 当用户点击提交按钮时,我如何将textbox的日期传递给服务器端代码? 以下是我的代码的一部分: 的.aspx: Date: 的.cs: protected void btnSubmit_Click(object sender, EventArgs e) { lblOutput.Text = //The date from the datepicker }

从另一个DropDownList填充DropDownList

我有两个相关的模型。 public partial class bs_delivery_type { public decimal delivery_id { get; set; } public decimal delivery_city_id { get; set; } public string delivery_address { get; set; } public virtual bs_cities bs_cities { get; set; } } 第二个: public partial class bs_cities { public bs_cities() { this.bs_delivery_type = new HashSet(); } public decimal cities_id { get; […]

从$ .post传递数组到Action

我无法通过$ .post传递我的数组。 Javascript var privIDs = [1,2,4,5]; $.post(“/Home/GrantPrivilegesToUser”, { privilegeIDs: privIDs }, function (data) { alert(“Data Loaded: ” + data.success); }); 那个行动 public ActionResult GrantPrivilegesToUser(int[] privilegeIDs) { return Json(new {success=true}); } 该操作将privilegeID视为null。 有任何想法吗?