Tag: asp.net

从codebehind触发jQuery ui对话框?

我想知道我怎么能从codebehind触发jquery ui对话框? 我需要这样做的原因是我需要在进行jquery调用之前保存文件。 可能吗?

jQuery Xpath选择器,用于选择id包含’sometext’的元素

我在aspx页面中有一个listbox元素,其id是attributesList。 我想选择这个元素来跟踪它的更改事件,但我无法直接选择它的id,因为asp.net在运行时更改了它的id。 它的id,attributesList变为ctl00_adminPlaceHolder_attributesList。 所以我想要做的是使用“包含”xpath表达式来选择元素。

如何在asp.net中使用jquery和json将数据保存到数据库中

我正在使用jquery和json将数据存储到数据库中的应用程序。 我的脚本function: function test() { $(document).ready(function () { var Email = document.getElementById(”).value; var Message = document.getElementById(”).value; var Name = document.getElementById(”).value; var ID=32; $.ajax({ type: “POST”, url: “Detail.aspx/InsertMethod”, data: “{‘Name’:'” + Name + “‘Email:'” + Email + “‘Message:'” + Message + “‘ID:'”+ID+”‘}”, dataType: “json”, contentType: “application/json; charset=utf-8”, success: function (data) { var returnedstring = data.d; } […]

触发JQuery事件后不会触发Codebehind OnClick事件

我在我的表单上的几个字段上使用html5约束validation,例如: 我想在点击时通过CSS和JQuery禁用提交按钮,但仅在validation通过后。 我试图像这样挂钩表单提交事件: var $form = $(‘#form1’); var $submitButton = $(‘#’); $form.submit(function () { $submitButton.prop(‘disabled’, true); }) 在validation后成功禁用按钮,会调用回发,但不会触发我的btnSubmit_click事件。 当html5约束validation通过时,我如何通过javacript / jquery确定所以我可以执行一个禁用按钮但仍允许我的btnSubmit_click事件触发的jquery函数? 更新:我使用简单的JQuery 2.0.3

ajax jquery post方法

我有如下所示的url DataProcessor.aspx的ajax请求,如何编写asp.net c#代码以从请求中提取json数据并在DataProcessor.aspx页面中显示 var json = “{‘ItemName’:'” + escape(item.val()) + “‘,’CategoryID’:'” + category.val() + “‘,’RecordID’:'” + record.val() + “‘}”; alert(escape(item.val())); alert(category.val()); alert(record.val()); var ajaxPage = “DataProcessor.aspx?Save=1”; //this page is where data is to be retrieved and processed var options = { type: “POST”, url: ajaxPage, data: json, contentType: “application/json;charset=utf-8”, dataType: “json”, async: false, success: function(response) […]

Gridview ImageButton在鼠标hover和鼠标移动时更改图像

我有Gridview,其中有一个Imagebutton。 它显示基于hfComplete(隐藏字段)值的图像。 如果值为true,则显示“images / completeiconfixed.png”并将属性附加到onmouseover“this.src =’images / completeiconfixed_transparant.png’;” 如果为false,则显示“images / completeiconfixed_transparant.png”并将该属性附加到onmouseout“this.src =’images / completeiconfixed.png’;” 到目前为止它只是第一次正常工作。 它可以很好地加载图像,当我第一次鼠标hover时它会改变图像,但第二次没有。 任何想法如何使它在每个鼠标上都能正常工作。 我的代码是吼叫。 <asp:ImageButton ID="imgComplete" runat="server" CommandName="completeRecord" CommandArgument='’ Height=”16px” Width=”16px”/> protected void grdNetwork_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { ImageButton imgComplete = (ImageButton)e.Row.FindControl(“imgComplete”); if (Convert.ToBoolean(hfCompleted.Value) == true) { imgComplete.ImageUrl = “images/completeiconfixed.png”; imgComplete.Attributes.Add(“onmouseover”, “this.src=’images/completeiconfixed_transparant.png’;”); } else { imgComplete.ImageUrl […]

如何使用Jquery和ASP.net将复选框转换为字符串以进行发布?

我正在尝试将复选框转换为可以使用我的asp.net代码通过电子邮件发送的字符串。 下面的代码使用Jquery脚本将html表单转换为ASP.net,工作正常。 但是,表单不会转换复选框。 即使在检查时,它总是将它们带入“否”。 除此之外,表格完美无缺。 它发送电子邮件很好,所有其他字段工作正常。 这是与复选框相关的HTML代码。 我很确定它与JQUERY和/或ASP.net代码有关。 Case 4 Contact Form Response.Write(sendMailSE(Convert.ToString(Request.Form(“name”)), Convert.ToString(Request.Form(“field1”)), Convert.ToString(Request.Form(“field2”)), Convert.ToString(Request.Form(“field3”)), Convert.ToString(Request.Form(“field4”)), Convert.ToString(Request.Form(“checkbox1”)), Convert.ToString(Request.Form(“checkbox2”)), Convert.ToString(Request.Form(“checkbox3”)), Convert.ToString(Request.Form(“comments”)))) Public Function sendMailSE(ByVal field1, ByVal field2, ByVal field3, ByVal field4, ByVal checkbox1, ByVal checkbox2, ByVal checkbox3, ByVal comments) As String Try Const ToAddress As String = “jdoe@abcd.com” ‘(1) Create the MailMessage instance Dim mm […]

从后面的代码调用javascript方法

我需要使用后面的代码中的参数调用JavaScript方法。 Javascript方法 function changeControlSample(path) { $find(”).set_UserControlPath(path); $find(”).refresh(); } Updating… 页面背后的代码 protected Consultation controlconsultation = new Consultation(); protected void Page_Load(object sender, EventArgs e) { PartialUpdatePanel7.UserControlPath = “Espace_Candidat/Consultation.ascx”; controlconsultation.imageinfo += controlconsultation_imageinfo; Session[“controlconsultation”] = controlconsultation; } void controlconsultation_imageinfo(object sender, CommandEventArgs e) { PartialUpdatePanel7.UserControlPath = “Espace_Candidat/InfoEdition.ascx”; Page.ClientScript.RegisterStartupScript(this.GetType(), “CallMyFunction”, “changeControlSample(‘Espace_Candidat/InfoEdition.ascx’)”, true); } 用户控件的代码 public event CommandEventHandler imageinfo ; protected void […]

突出显示母版页中的活动菜单项

我正在使用我的菜单项的主人。 由于我使用母版页,我很困惑如何突出显示活动菜单项。 谁能帮我吗。 由于我有4个页面,我在4页的所有页面加载事件中尝试了以下代码并且无法正常工作。 if (!IsPostBack) { Menu M = (Menu)this.Master.FindControl(“menu”); foreach (MenuItem item in M.Items) { if (item.Text == “update”) { item.Selected = true; } } } Update Bulk Profiles Help #menu ul { margin: 0; padding: 7px 6px 0; background: #b6b6b6 url(‘/Images/Overlay.png’) repeat-x 0 -110px; line-height: 100%; border-radius: 1em; font: normal 0.5333333333333333em Arial, […]

ObjectContext实例已被释放,不能再用于需要连接错误级联下拉列表的操作

我尝试在MVC4中级联下拉列表。 我有2个下拉列表1 – 类别2 – 子类别。 当用户创建新产品时,他需要选择Category,然后选择与该类别相关的SubCategory。 我和杰森一起使用ajax。 public ActionResult Create() { List allcategories = new List(); List allSubCategories = new List(); using (WebStoreEntities1 db1 = new WebStoreEntities1()) { allcategories = db1.Categories.OrderBy(x => x.CategoryName).ToList(); } ViewBag.categoryID = new SelectList(db.Categories, “CategoryId”, “CategoryName”); ViewBag.SubCategoryID = new SelectList(allSubCategories, “SubCategoryId”, “SubCategoryName”); return View(main); } 在html页面中的Jquery代码: $(document).ready(function () { var […]