scriptmanager

asp.net ScriptManager PageMethods is undefined

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-17 09:53:12
问题 I want to call static server-side methods from JS so i decide to use ScriptManager control on my site. So i have a master page, with such structure: <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="TopLevelMasterPage.Master.cs" Inherits="Likedrive.MasterPages.TopLevelMasterPage" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#"> <head

ScriptManager.RegisterStartupScript code not working - why?

巧了我就是萌 提交于 2019-12-17 02:38:12
问题 I have used code like this in the past to successfully pop up an alert message on my asp.net webpage. Now it is not working. I can't figure out why. ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "alert('This pops up')", true); Any ideas? 回答1: Off the top of my head: Use GetType() instead of typeof(Page) in order to bind the script to your actual page class instead of the base class, Pass a key constant instead of Page.UniqueID , which is not that meaningful since it's

call js confirm from code behind

落爺英雄遲暮 提交于 2019-12-14 02:36:14
问题 codebehind Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDelete.Click Dim ResourceObject As Object Dim js As [String] = (vbCr & vbLf & " if(confirm('Esta Seguro de eliminar de la lista')==true)" & vbCr & vbLf & " document.getElementById('" & txtRespuesta.ClientID & "').value='true';" & vbCr & vbLf & " else" & vbCr & vbLf & " document.getElementById('") + txtRespuesta.ClientID & "').value='false';" & vbCr & vbLf & " " ScriptManager

Startup script registered with ScriptManager.RegisterStartupScript is not rendered to page

点点圈 提交于 2019-12-13 17:19:31
问题 I have a call to ScriptManager.RegisterStartupScript in ASP.NET 3.5 that isn't being rendered to the page and I can't figure out why: System.Web.UI.ScriptManager.RegisterStartupScript( Page , typeof(ListControlBase) , "ShowPopup_" + ClientID , "alert(\"HI\");" , true ); The above call sits inside of a button handler in a base class (ListControlBase) that is sub-classed by a user control with an UpdatePanel (List Manager Control). This user control exists to manage a list of 1 to n copies of

Scriptmanager remove javascript

最后都变了- 提交于 2019-12-13 04:43:47
问题 The ASP.NET ScriptManager control automatically inserts all kinds of inline javascript like PageRequest initialize. Is it possible to remove or move this to an external js file? Also, the scriptmanager always adds __DoPostback even when not used on the page, how can this be avoided or also moved to an external file? 回答1: First of all the "__DoPostBack" is inserted by controls that can cause a postback such as the DropDownList with the AutoPostBack property set to true. Since the ScriptManager

Unable to trigger JavaScript method from code-behind using Update Panel

╄→гoц情女王★ 提交于 2019-12-13 01:18:51
问题 Issue details: After saving the data in DB, I need to show an alert to the user. For this, I have registered the script from code-behind. But it is NOT working with update-panel whereas it works as expected without update-panel. I need to make it work with update-panel. I tried by adding $(document).ready(function () while registering the script, but it didn't work. Then, I tried with ScriptManager.RegisterClientScriptBlock() method instead of Page.ClientScript.RegisterStartupScript() , but

VS2010 Automatically rebuild minified .js/.css files

為{幸葍}努か 提交于 2019-12-12 16:29:54
问题 Problem : I have been trying to integrate minification of javascript and css files in our VS2010 (.net 4.) projects. From what I hear, .net 4.5 and VS2012 will have minification build into the editor, so it will be as easy as setting a flag it will work. Unfortunately we are sill on VS2010 (.net 4.0). Let me explain what I want to do and what I dont want to do. I dont want to do big setups with classes/config file(s)/etc just to minify because all that stuff will have to be loaded on our

update panel with file upload

牧云@^-^@ 提交于 2019-12-12 14:06:34
问题 <asp:FileUpload runat="server" ID="uploadCertification" /> <asp:Button runat="server" ID="btntext" OnClick="btntext_Click" /> Code uploadCertification.PostedFile.SaveAs(serverPathImage + "\\CertificationCompany\\as.td"); this code work fine but when <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel3" runat="server"><ContentTemplate> <asp:FileUpload runat="server" ID="uploadCertification" /> <asp:Button runat="server" ID="btntext"

ScriptManager duplicates javascript

点点圈 提交于 2019-12-12 03:54:14
问题 I have a usercontrol that can be used in for example a gridview itemtemplate, this means that the control might or might not be on the page at page load. In the case where the control is inside an itemtemplate i will popupate the gridview via asynchronous postbacks (via updatepanels). The control itselfs registrers scriptblocks since it is depending on javascripts. First i used Page.ClientScript.RegistrerClientScriptBlock But this doesn't work on asynchronous postbacks (updatepanels) so i

Javascript function is not getting call from code behind when it is put on master page

僤鯓⒐⒋嵵緔 提交于 2019-12-11 19:06:43
问题 I have 2 pages named as : Abc.aspx and popupAbc.aspx Now on Abc.aspx i have below button on click of which i am opening popupAbc.aspx as pop up: <asp:Button ID="btnOpenChildAbcPopup" runat="server" Text="Open" UseSubmitBehavior="false" CausesValidation="False" OnClick="btnOpenChildAbcPopup_Click" /> Code Behind: protected void btnOpenChildAbcPopup_Click(object sender, EventArgs e) { string url="../popupAbc.aspx"; ScriptManager.RegisterStartupScript(Page, GetType(), "alert", "OpenChildAbcPopup