scriptmanager

ASP CompositeControl & ScriptManager

房东的猫 提交于 2019-12-24 10:36:26
问题 I'm really new to the WebControl / CompositeControl world, and I have a small test class I am playing with. It's just a LinkButton that updates when clicked. Things work great when I leave it out of UpdatePanel . But when I try to run it inside I still get a full page POST response. How can I make this class work inside a UpdatePanel ? Here's the class: public class Test2 : CompositeControl { private static readonly object testButtonEvent = new object(); public event EventHandler OnTestClick

How to use external js file in ScriptManager.RegisterStartupScript?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 20:06:50
问题 i have a control which is on update panel. i want my javascript code run every time the updatePAnel is updated. i use something like this: ScriptManager.RegisterStartupScript(this, GetType(), "my_script", "runFunction();", true); the problem is that my js code is huge and i want to place it in js file and use it from file. what should i change in my code ? 回答1: You could use the ScriptManager.RegisterClientScriptInclude method: ScriptManager.RegisterClientScriptInclude( updatePanel,

ASP.NET Timer only works in debug mode

久未见 提交于 2019-12-23 09:42:24
问题 I am using the ajax timer control inside an update panel. <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick"></asp:Timer> <asp:Label ID="Label1" runat="server" Text=""></asp:Label> </ContentTemplate> </asp:UpdatePanel> The timer should update the label every second with the current datetime. protected void Timer1_Tick(object sender, EventArgs e) { Label1.Text = DateTime.Now.ToString(); } Everything

scriptreference named respond no longer works

白昼怎懂夜的黑 提交于 2019-12-23 09:07:41
问题 Using: Visual Studio Express 2013 for Web to write a .NET 4.5.1 site. Project initially built on the default "Create New Website" template therefore the parts in question were added to my project by the IDE and have not been edited. This has been a several weeks long project and today I began receiving an error out of the blue in relation to "canned" items added at create time. It has been working without error until now. The error message is: Server Error in '/' Application. 'respond' is not

ScriptManager.RegisterStartupScript not working on ASP Button click event

巧了我就是萌 提交于 2019-12-22 09:38:29
问题 what I have tried I'm trying this since yesterday, to trigger a alert() when an ASP Button_Click . However, when I paste this script in Page_Load it works perfectly fine. ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Fill all fields.');", true); I have also tried it with below code, ClientScript.RegisterStartupScript which works on page load and not on ASP Button_Click ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Fill all fields.');", true);

Navigate to a new page and display an alert box

北城余情 提交于 2019-12-20 04:25:10
问题 I am developing an application by using ASP.Net WebForm. Once user click a button, application will navigate to a new page and prompt out a dialog box "Welcome to JackiesGame" However, I able to navigate to new page but the alert dialog box does not display. The following is my sample code void cmdCancel_Click(object sender, EventArgs e) { HttpContext.Current.Response.Redirect(Globals.NavigateURL(TabId), true); Page page2 = HttpContext.Current.CurrentHandler as Page; ScriptManager

Navigate to a new page and display an alert box

怎甘沉沦 提交于 2019-12-20 04:25:03
问题 I am developing an application by using ASP.Net WebForm. Once user click a button, application will navigate to a new page and prompt out a dialog box "Welcome to JackiesGame" However, I able to navigate to new page but the alert dialog box does not display. The following is my sample code void cmdCancel_Click(object sender, EventArgs e) { HttpContext.Current.Response.Redirect(Globals.NavigateURL(TabId), true); Page page2 = HttpContext.Current.CurrentHandler as Page; ScriptManager

Disable ScriptManager on certain pages

杀马特。学长 韩版系。学妹 提交于 2019-12-19 09:11:29
问题 I have a script manager on my Master page. There are one or 2 content pages that I need to remove the webresourse.axd from, as it is causing issues with other javascript on the page How can I disable the script manager on these pages? The ScriptManager object doesnt appear to have any properties that would seem like they would do the job Is this possible? 回答1: Move your <asp:ScriptManager /> to a custom control e.g. MyScriptManager.ascx - the only code in the .ascx file will be the

How can you tell if a method is being run in UpdatePanel postback?

梦想的初衷 提交于 2019-12-18 11:06:15
问题 How can I tell if a method is running in the context of an AJAX postback (i.e as the result of a UpdatePanel (asynchronous) postback)? According to egoldin Page.IsAsync is a very common confusion that has absolutely nothing to do with AJAX. The correct approach is to use ScriptManager.GetCurrent ( Page ).IsInAsyncPostBack. 回答1: Use ScriptManager.GetCurrent ( Page ).IsInAsyncPostBack 来源: https://stackoverflow.com/questions/265686/how-can-you-tell-if-a-method-is-being-run-in-updatepanel

How can I call web service methods from javascript?

馋奶兔 提交于 2019-12-18 04:52:16
问题 Is there any way to call web services from javascript? I know you can add in a script manager to pull in the web services but I can't figure out how to access the functions from javascript once I've done that. Thanks, Matt 回答1: Please see Calling Web Services from Client Script in ASP.NET AJAX: This topic explains how to use to call a Web service from ECMAScript (JavaScript). To enable your application to call ASP.NET AJAX Web services by using client script, the server asynchronous