clientscript

ClientScript not working properly on class C#

梦想与她 提交于 2020-02-07 02:37:07
问题 I want to deploy a script on C# which usually uses methods like: ClientScript.RegisterStartupScript(GetType(), "script", "Details('" + hdnId.Value + "');", true); However I wanted to make a class that runs that code: public class WebUtilities { public static void CustomScript(Page objPage, string strScript) { objPage.ClientScript.RegisterStartupScript(objPage.GetType(), "script", strScript, true); } } When I call WebUtilities.CustomScript, sometimes it works, but leaves a //]]> at the bottom

Yii renderpartial (proccessoutput = true) Avoid Duplicate js request

邮差的信 提交于 2019-12-28 05:30:13
问题 Im creating a site who works with ajaxRequest, when I click a link, it will load using ajaxRequest. When I load for example user/login UserController actionLogin , I renderPartial the view with processOUtput to true so the js needed inside that view will be generated, however if I have clientScriptRegister inside that view with events, how can I avoid to generate the scriptRegistered twice or multiple depending on the ajaxRequest? I have tried Yii::app()->clientScript->isSCriptRegistered(

showing ClientScript Alerts before Redirecting to another page in ASP.NET c#?

坚强是说给别人听的谎言 提交于 2019-12-21 19:17:12
问题 I gotta address a problem here... I'm developing a system where I am constantly showing Messages to the user, For instance... I'm adding a new client, I input all the data and press Save, ON C# what I do is do all the process of saving, then I use... ClientScript.RegisterStartupScript(this.GetType(), "Mensaje", "alert('Client Saved Successfully');", true); And that's it... Eventually the message is displayed since I'm staying in the same site (because if I want to add another client, I must

ClientScript.RegisterStartupScript not working

两盒软妹~` 提交于 2019-12-19 19:48:30
问题 I have searched SO & google, but I can't seem to get this to work. The code is in the codebehind click event of a "Cancel" button in my asp.net application but does not seem to close the popup window. Any ideas? try { if (btnCancel.Text == "Close") { String csName1 = "PopupScript"; Type csType = this.GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsClientScriptBlockRegistered(csType, csName1)) { ClientScript.RegisterStartupScript(GetType(), "ClosePopup", "window.close();",

How to execute multiple ClientScript.RegisterStartupScript in ASP.NET c#?

痴心易碎 提交于 2019-12-13 00:48:27
问题 I'm developing a gridview in which you can download multiple files with one button. Here's my gridview: <asp:GridView ID="grdvHistorialMensajes" runat="server" AllowPaging="True" AutoGenerateColumns="False" CellPadding="4" AllowSorting="true" EmptyDataText="No Hay Mensajes Enviados" ForeColor="#333333" GridLines="None" CellSpacing="1" onpageindexchanging="grdvHistorialMensajes_PageIndexChanging" onrowcommand="grdvHistorialMensajes_RowCommand" onsorting="grdvHistorialMensajes_Sorting">

How to unregister Page.ClientScript in C# Asp.net

我的梦境 提交于 2019-12-11 05:03:41
问题 I am registering java script to my Asp.net code behind file, which is working fine. Now, I have some update panels on the same page and problem is whenever there is any change in any of the update panel, this script is automatically getting called. Is there any way that I can stop this happening. I can't remove update panels from my page and this script is also a very essential part of the application. In this situation I am just calling a alert (rad alert with set time out functionality)

showing ClientScript Alerts before Redirecting to another page in ASP.NET c#?

大城市里の小女人 提交于 2019-12-04 10:00:20
I gotta address a problem here... I'm developing a system where I am constantly showing Messages to the user, For instance... I'm adding a new client, I input all the data and press Save, ON C# what I do is do all the process of saving, then I use... ClientScript.RegisterStartupScript(this.GetType(), "Mensaje", "alert('Client Saved Successfully');", true); And that's it... Eventually the message is displayed since I'm staying in the same site (because if I want to add another client, I must stay in the sme site, not send me back to my MAIN SCREEN) or at least I'm not telling the system to do a

ClientScript.RegisterStartupScript not working

心已入冬 提交于 2019-12-01 18:13:26
I have searched SO & google, but I can't seem to get this to work. The code is in the codebehind click event of a "Cancel" button in my asp.net application but does not seem to close the popup window. Any ideas? try { if (btnCancel.Text == "Close") { String csName1 = "PopupScript"; Type csType = this.GetType(); ClientScriptManager cs = Page.ClientScript; if (!cs.IsClientScriptBlockRegistered(csType, csName1)) { ClientScript.RegisterStartupScript(GetType(), "ClosePopup", "window.close();", true); } } } Update: After postback, when I look at the source page, the only code I see related is: //<!

how to detect the Page Close Event with ASP.NET

拥有回忆 提交于 2019-11-30 20:07:04
I have a ASP.NET web app with a MasterPage and contents page, from the MasterPage when I click a MenuItem to open a new aspx Page. if I want to close the new page browser tab, I want to show a popup or a dialog that alert the user that he is closing the browser tab. I dont know how to detect the close browserTab button. I used the following code in the new aspx page: <script type="text/javascript"> function CloseWindow() { alert('closing'); window.close(); } </script> new page code behind: protected void Page_Load(object sender, EventArgs e) { Page.ClientScript.RegisterOnSubmitStatement(typeof

how to detect the Page Close Event with ASP.NET

主宰稳场 提交于 2019-11-30 04:50:38
问题 I have a ASP.NET web app with a MasterPage and contents page, from the MasterPage when I click a MenuItem to open a new aspx Page. if I want to close the new page browser tab, I want to show a popup or a dialog that alert the user that he is closing the browser tab. I dont know how to detect the close browserTab button. I used the following code in the new aspx page: <script type="text/javascript"> function CloseWindow() { alert('closing'); window.close(); } </script> new page code behind: