Tag: asp.net

JavaScript code to refresh page and or telerik grid

I need some kind of code which will refresh the page every 5min and if not the page then just the Telerik grid displayed on it since that’s all that’s rly needed. Only other thing would be if it was after 5min of no activity on the page if possible but it’s not core feature.

c# Multiple calls to a javascript function not working

On a click event I call the same JavaScript function 3 times but the javascript function itself only execute once. BLL.Common.executeJSFunction(“DoSomething();”); BLL.Common.executeJSFunction(“DoSomething();”); BLL.Common.executeJSFunction(“DoSomething();”); The method: public static void executeJSFunction(string jsFunction) { var page = HttpContext.Current.Handler as Page; ScriptManager.RegisterStartupScript(page, page.GetType(), “Exec”, jsFunction, true); } Java script function: function DoSomething() { alert(‘Hello Word’); } ps: There is […]

cancel postback from javascript on confirm popup

Following this problem ASP.NET: OnServerClick event handler not called if using onclick I implemented a workaround: <button id=”idBtnPrint” runat=”server” type=”submit” onserverclick=”BtnPrint_Click” onclick=”confirmImpression();”>print</button> javascript function: function confirmImpression() { if (!confirm(“sure ?”)) arg.whatever; } where confirmation is positive the postback is started when cancel the postback is not run (as I want) simply because an error generated […]

How can I persist the state of slideToggle at post back?

I want jQuery slideToggle() to persist it’s state. By default when the page loads it is collapsed. For the <div> that has the slideToggle() applied there is an asp: button, and when clicked some operation is performed, but probably a page post back occurs. If the page is refreshed the initial state of the <div> […]

Is it good to use Wait cursor in websites?

Is it good to use Wait cursor in websites? On heavy loading pages I don’t generally see it used with websites. (please share some if you have seen any.) If I implement the below code, will it be compatible with the current browsers? function doHourglass() { document.body.style.cursor = ‘wait’; } and <form runat=”server” onsubmit=”return setHourglass();”>

what will be the regular expression of date format 'dd-M-y'

what will be the regular expression of date format like ’01-Aug-12′. I have the date format of dd-M-y in asp.net application and want to validate it from asp.net regular expression validator control.

javascript ASP.NET hiddenfield get value from code behind

I am trying to integrate my codes to Google Chart API. I want to manually set google chart title and axis column names from code behind. I tried below code but doesn’t work. Any suggestions? ASPX file <asp:Content ID=”HeaderContent” runat=”server” ContentPlaceHolderID=”HeadContent”> <script type=”text/javascript” src=”https://www.google.com/jsapi”></script> <script type=”text/javascript”> google.load(“visualization”, “1”, { “packages”: [“corechart”] }); function drawProgrammingChart() { […]

Stopping select.change from posting back

this problem is part of a bigger page but I’ve simplified the code to provide an easy example of what I’m talking about. Basically I have an ASP dropdownlist with AutoPostBack=”true” and I want to do some javascript client side which can stop the postback if necessary. However, I can’t get it to stop the […]

ASP.NET Button, executing OnClick only if OnClientClick returns true

I have a button that looks like: <asp:Button ID=”btnSave” runat=”server” CssClass=”SubmitButton” Text=”Order >>” OnClientClick=”return SaveChanges();” OnClick=”btnSave_Click” /> A javascript function that looks like: function SaveChanges() { var success = false; var arr1 = new Array(); var arr2 = new Array(); var arr3 = new Array(); for (var i = 0; i < self.frames.length-1; i++) { […]

requirejs timing issue – some bootstrap js doesn't work

I am running into an odd issue ever since starting to use requireJs. This issue only seems to happen on some sidebar menu items that can be expanded to see the sub-menu items. RequireJS module is called at the very end, before the body tag, and other JS on the page itself works fine, just […]