Search Results

Search found 124 results on 5 pages for 'pageload'.

Page 2/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • how to fire the function event on PageLoad event of XtraReport ?

    - by ahmed
    I have a situation, I am working on a XtraReport where I am pulling some data from table.Now I created a function and passing a parameter at runtime for the report to generate. But when I fire the function event from a Onclick Button the result is perfect but when I fire the same function event on the page load of the ReportViewer ..I do not get the result. About function , i am creating dataset, and adapter with Sqlquery from runtime passing the parameter value from a session in the query and binding the data to the labels. But as I said I want the result on the pageload event of the reportviewer.

    Read the article

  • How can I speed up a 1800-line PHP include? It's slowing my pageload down to 10sec/view

    - by somerandomguy
    I designed my code to put all important functions in a single PHP file that's now 1800 lines long. I call it in other PHP files--AJAX processors, for example--with a simple "require_once("codeBank.php")". I'm discovering that it takes about 10 seconds to load up all those functions, even though I have nothing more than a few global arrays and a bunch of other functions involved. The main AJAX processor code, for example, is taking 8 seconds just to do a simple syntax verification (whose operational function is stored in codeBank.php). When I comment out the require_once, my AJAX response time speeds up from 10sec to 40ms, so it's pretty clear that PHP's trying to do something with those 1800 lines of functions. That's even with APC installed, which is surprising. What should I do to get my code speed back to the sub-100ms level? Am I failing to get the cache's benefit somehow? Do I need to cut that single function bank file into different pieces? Are there other subtle things that I could be doing to screw up my response time? Or barring all that, what are some tools to dig further into which PHP operations are hitting speed bumps?

    Read the article

  • Loading Nested JS Files on the Page

    - by Aidin
    Hi, I have a JS file that is dependent to another Js file. this Js file is something like this (Common.js) //Some codes here window.onload = PageLoad; //some codes here and then I implement PageLoad function in another Js file. ( I do this because every page has its own PageLoad implementation) and I Load these files like this on my Main.aspx : `<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">` `<\script language="javascript" type="text/javascript" src="PagesJS/pgeMain.js"></script>` `<\script language="javascript" type="text/javascript" src="JS/Common.js"></script>` ... ... `</asp:Content>` Every thing works fine on local but when I deploy it, sometimes I get PageLoad undefined Error! Can any one tells me what is wrong with this? Thanks. Aidin

    Read the article

  • Autocomplete jQuery on User Controller within Repeater .NET

    - by TheDPQ
    I have a Multiview search feature on a Web User Controller that is called within a Repeater, OHMY!! I have some training sessions being listed out on a page, each calling an employeeSearch Web User Controller so people can search for employees to add to the training session. I have the Employee Names and Employee IDs listed out in JS on the page and using the jQuery autocomplete i have them search for the employee and populate a hidden field in the User controller. Once the process is done they have the option of adding yet another employee. So i had Autocompelte 'work' in all the employee search boxes, but one i do the initial search (postback) autocomplete won't work again. Then i updated $().ready(function() to pageLoad() so it works correctly on multiple searches but only in the LAST item of the repeater (jQuery is loaded on the User Controller) FYI: I have the JS string set as EMPLOYEENAME|ID and jQuery displays the Employee Name and if they select it throws the ID in a ASP:HIDDEN FIELD <script type="text/javascript"> format_item = function(item, position, length) { var str = item.toString().split("|", 2); return str[0]; } function pageLoad() { $("#<%=tb_EmployeeName.ClientID %>").autocomplete(EmployeeList, { minChars: 0, width: 500, matchContains: true, autoFill: false, scrollHeight: 300, scroll: true, formatItem: format_item, formatMatch: format_item, formatResult: format_item }); $("#<%=tb_EmployeeName.ClientID %>").result(function(event, data, formatted) { var str = data.toString().split("|", 2); $("#<%=hf_EmployeeID.ClientID %>").val(str[1]); }); }; </script> I can already guess that by repeating pageLoad within the User Controll i override the previous pageLoad. THE QUESTION: Is there a way around this, a way to have all the jQuery appear in a single pageLoad or to somehow have a single jquery call to handle all my search boxes? I can't move the jQuery into the page calling all the controllers because i have no way of referencing the specific *tb_EmployeeName* textbox AND *hf_EmployeeID* hidden field. Thank you so much for any help or insight you can give me into this problem. This is the Multiview that on the User Controller <asp:MultiView ID="mv_EmployeeArea" runat="server" ActiveViewIndex="0"> <asp:View ID="vw_Search" runat="server"> <asp:Panel ID="eSearch" runat="server"> <b>Signup Employee Search</b> (<i>Last Name, First Name</i>)<br /> <asp:TextBox ID="tb_EmployeeName" class="EmployeeSearch" runat="server"></asp:TextBox> <asp:HiddenField ID="hf_EmployeeID" runat="server" /> <asp:Button ID="btn_Search" runat="server" Text="Search" /> </asp:Panel> </asp:View> <asp:View ID="vw_Confirm" runat="server"> <b>Signup Confirmation</b> <asp:FormView ID="fv_EmployeeInfo" runat="server"> <ItemTemplate> <%#(Eval("LastName"))%>, <%#(Eval("FirstName"))%><br /> </ItemTemplate> </asp:FormView> <asp:Button ID="btn_Confirm" runat="server" Text="Signup this employee" /> &nbsp; <asp:Button ID="btn_Reset3" runat="server" Text="Reset" /> </asp:View> <asp:View ID="vw_ThankYou" runat="server"> <b>Thank You</b><br /> The employee has been signed up and an email confirmation has been sent out.<br /><br /> <asp:Button ID="btn_Reset" runat="server" Text="Reset" /> </asp:View> </asp:MultiView> UPDATE: I never did find an answer but i had to do a demo so i hacked together something that 'works', but feels sort of cheesy. I am still very much needed of a better question or better understanding.

    Read the article

  • Search in Repeater

    - by user2797643
    On pageload i want to show all fields in repeater control and on typing licenseid in the textbox i want to show that specific licenceid details IF I place below code in the datasource of repeater,First one is not working.In the second one i placed a textbox and put its value to 0 on pageload.it is working.But i want both to be working. SELECT * FROM License WHERE (0 = @selectAll OR LicenseID=@LicenseID) -> Not working SELECT * FROM License WHERE (0 = @selectAll ) ->working SELECT * FROM License WHERE (LicenseID=@LicenseID)-> working Thanks in advance for the help

    Read the article

  • Implementing History Support using jQuery for AJAX websites built on asp.net AJAX

    - by anil.kasalanati
    Problem Statement: Most modern day website use AJAX for page navigation and gone are the days of complete HTTP redirection so it is imperative that we support back and forward buttons on the browser so that end users navigation is not broken. In this article we discuss about solutions which are already available and problems with them. Microsoft History Support: Post .Net 3.5 sp1 Microsoft’s Script manager supports history for websites using Update panels. This is achieved by enabling the ENABLE HISTORY property for the script manager and then the event “Page_Browser_Navigate” needs to be handled. So whenever the browser buttons are clicked the event is fired and the application can write code to do the navigation. The following articles provide good tutorials on how to do that http://www.asp.net/aspnet-in-net-35-sp1/videos/introduction-to-aspnet-ajax-history http://www.codeproject.com/KB/aspnet/ajaxhistorymanagement.aspx And Microsoft api internally creates an IFrame and changes the bookmark of the url. Unfortunately this has a bug and it does not work in Ie6 and 7 which are the major browsers but it works in ie8 and Firefox. And Microsoft has apparently fixed this bug in .Net 4.0. Following is the blog http://weblogs.asp.net/joshclose/archive/2008/11/11/asp-net-ajax-addhistorypoint-bug.aspx For solutions which are still running on .net 3.5 sp1 there is no solution which Microsoft offers so there is  are two way to solve this o   Disable the back button. o   Develop custom solution.   Disable back button Even though this might look like a very simple thing to do there are issues around doing this  because there is no event which can be manipulated from the javascript. The browser does not provide an api to do this. So most of the technical solution on internet offer work arounds like doing a history.forward(1) so that even if the user clicks a back button the destination page redirects the user to the original page. This is not a good customer experience and does not work for asp.net website where there are different views in the same page. There are other ways around detecting the window unload events and writing code there. So there are 2 events onbeforeUnload and onUnload and we can write code to show a confirmation message to the user. If we write code in onUnLoad then we can only show a message but it is too late to stop the navigation. And if we write on onBeforeUnLoad we can stop the navigation if the user clicks cancel but this event would be triggered for all AJAX calls and hyperlinks where the href is anything other than #. We can do this but the website has to be checked properly to ensure there are no links where href is not # otherwise the user would see a popup message saying “you are leaving the website”. Believe me after doing a lot of research on the back button disable I found it easier to support it rather than disabling the button. So I am going to discuss a solution which work  using jQuery with some tweaking. Custom Solution JQuery already provides an api to manage the history of a AJAX website - http://plugins.jquery.com/project/history We need to integrate this with Microsoft Page request manager so that both of them work in tandem. The page state is maintained in the cookie so that it can be passed to the server and I used jQuery cookie plug in for that – http://plugins.jquery.com/node/1386/release Firstly when the page loads there is a need to hook up all the events on the page which needs to cause browser history and following is the code to that. jQuery(document).ready(function() {             // Initialize history plugin.             // The callback is called at once by present location.hash.             jQuery.history.init(pageload);               // set onlick event for buttons             jQuery("a[@rel='history']").click(function() {                 //                 var hash = this.page;                 hash = hash.replace(/^.*#/, '');                 isAsyncPostBack = true;                 // moves to a new page.                 // pageload is called at once.                 jQuery.history.load(hash);                 return true;             });         }); The above scripts basically gets all the DOM objects which have the attribute rel=”history” and add the event. In our test page we have the link button  which has the attribute rel set to history. <asp:LinkButton ID="Previous" rel="history" runat="server" onclick="PreviousOnClick">Previous</asp:LinkButton> <asp:LinkButton ID="AsyncPostBack" rel="history" runat="server" onclick="NextOnClick">Next</asp:LinkButton> <asp:LinkButton ID="HistoryLinkButton" runat="server" style="display:none" onclick="HistoryOnClick"></asp:LinkButton>   And you can see that there is an hidden HistoryLinkButton which used to send a sever side postback in case of browser back or previous buttons. And note that we need to use display:none and not visible= false because asp.net AJAX would disallow any post backs if visible=false. And in general the pageload event get executed on the client side when a back or forward is pressed and the function is shown below function pageload(hash) {                   if (hash) {                         if (!isAsyncPostBack) {                           jQuery.cookie("page", hash);                     __doPostBack("HistoryLinkButton", "");                 }                isAsyncPostBack = false;                             } else {                 // start page             jQuery("#load").empty();             }         }   As you can see in case there is an hash in the url we are basically do an asp.net AJAX post back using the following statement __doPostBack("HistoryLinkButton", ""); So whenever the user clicks back or forward the post back happens using the event statement we provide and Previous event code is invoked in the code behind.  We need to have the code to use the pageId present in the url to change the page content. And there is an important thing to note – because the hash is worked out using the pageId’s there is a need to recalculate the hash after every AJAX post back so following code is plugged in function ReWorkHash() {             jQuery("a[@rel='history']").unbind("click");             jQuery("a[@rel='history']").click(function() {                 //                 var hash = jQuery(this).attr("page");                 hash = hash.replace(/^.*#/, '');                 jQuery.cookie("page", hash);                 isAsyncPostBack = true;                                   // moves to a new page.                 // pageload is called at once.                 jQuery.history.load(hash);                 return true;             });        }   This code is executed from the code behind using ScriptManager RegisterClientScriptBlock as shown below –       ScriptManager.RegisterClientScriptBlock(this, typeof(_Default), "Recalculater", "ReWorkHash();", true);   A sample application is available to be downloaded at the following location – http://techconsulting.vpscustomer.com/Source/HistoryTest.zip And a working sample is available at – http://techconsulting.vpscustomer.com/Samples/Default.aspx

    Read the article

  • asp.net Can I force every page to inherit from a base page? Also should some of this logic be in my master page?

    - by Bex
    Hi! I have a web app that has a base page. Each page needs to inherit from this base page as it contains properties they all need as well as dealing with the login rights. My base page has some properties, eg: IsRole1, IsRole2, currentUserID, Role1Allowed, Role2Allowed. On the init of each page I set the properties "Role1Allowed" and "Role2Allowed" Private Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init Role1Allowed = True Role2Allowed= False End Sub The basepage then decides if the user needs redirecting. 'Sample code so not exactly what is going to be, bug gives the idea Protected Overridable Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) If Role1Allowed And Not Role1 Then 'Redirect somewhere End If End Sub The page then must override this pageload if they need anything else in it, but making sure they call the base pageload first. Protected Overrides Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load MyBase.Page_Load(sender, e) If Not IsPostBack Then BindGrid() End If End Sub The other properties (IsRole1, IsRole, currentUserID) are also accessible by the page so it can be decided if certain things need doing based on the user. (I hope this makes sense) Ok so I have 2 questions Should this functionality be in the base page or should it somehow be in the master, and if so how would I get access to all the properties if it was? As there are multiple people working on this project and creating pages some are forgetting to inherit from this basepage, or call the base pageload when overriding it. Is there any way to force them to do this? Thanks for any help. bex

    Read the article

  • Setting the SlideShowExtender's Index

    - by Bunch
    The AJAX SlideShowExtender is pretty useful. It does what it says and works without much fuss. There was one trick I needed it to perform that I could not find natively within the control. That was to set the slide’s current index. With a little JavaScript however I could make the control do what I wanted. The example below assumes a few things. First you already have a SlideShowExtender setup and working (or see this post). Second this SlideShowExtender is on a page all by itself so the index to set the slide to is passed in the URL. The scenario I had was this SSE was showing full images, the index was passed from another page that had a SSE showing thumbnails. JavaScript in <head> <script type="text/javascript">      function pageLoad() {          var slider = $find("sse");          var photoIndex = GetQuerystring('Index', 0);          slider._currentIndex = photoIndex - 1;          slider._slides = '';          slider.setCurrentImage();      }      function GetQuerystring(key, default_) {          if (default_ == null) default_ = '0';          key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");          var regex = new RegExp("[\\?&]" + key + "=([^&#]*)");          var qs = regex.exec(window.location.href);          if (qs == null)              return default_;          else              return qs[1];      } </script> The GetQuerystring function is what grabs the Index value I pass from the page with the thumbnails. It does not have anything else to do with setting the slide index. The code in the pageLoad function sets the index on the slide_currentIndex line. The slider.setCurrentImage() line does pretty much what it says. I added the slider._slider = ‘’ to avoid an error (not a show stopper just a bit annoying). Control in <body> <cc1:SlideShowExtender ID="ssePhotos" runat="server" TargetControlID="imgFull" AutoPlay="false"          PreviousButtonID="btnPrev" NextButtonID="btnNext" SlideShowServicePath="PlacePhotos.asmx"           SlideShowServiceMethod="GetPlaceFullPhotos" BehaviorID="sse" ImageDescriptionLabelID="lblPictureDescription"> </cc1:SlideShowExtender> The main property to set with the SSE is the BehaviorID. This is what a JavaScript function can use to find the control rather than the control’s ID value. Technorati Tags: AJAX,ASP.Net,JavaScript

    Read the article

  • add_shown & add_hiding ModalPopupExtender Events

    - by Yousef_Jadallah
        In this topic, I’ll discuss the Client events we usually need while using ModalPopupExtender. The add_shown fires when the ModalPopupExtender had shown and add_hiding fires when the user cancels it by CancelControlID,note that it fires before hiding the modal. They are useful in many cases, for example may you need to set focus to specific Textbox when the user display the modal, or if you need to reset the controls values inside the Modal after it has been hidden. To declare Client event either in pageLoad javascript function or you can attach the function by Sys.Application.add_load like this: Sys.Application.add_load(modalInit); function modalInit() { var modalPopup = $find('mpeID'); modalPopup.add_hiding(onHiding); } function onHiding(sender, args) { } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }   I’ll use the first way in the current example. So lets start with the illustration:   1- In this example am using simple panel which contain UserName and Password Textboxes besides submit and cancel buttons, this Panel will be used as PopupControlID in the ModalPopupExtender : <asp:Panel ID="panModal" runat="server" Height="180px" Width="300px" style="display:none" CssClass="ModalWindow"> <table width="100%" > <tr> <td> User Name </td> <td> <asp:TextBox ID="txtName" runat="server"></asp:TextBox> </td> </tr> <tr> <td> Password </td> <td> <asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox> </td> </tr> </table> <br /> <asp:Button ID="btnSubmit" runat="server" Text="Submit" /> <asp:Button ID="btnCancel" runat="server" Text="Cancel" /> </asp:Panel>   You can use this simple style for the Panel : <style type="text/css"> .ModalWindow { border: solid; border-width:3px; background:#f0f0f0; } </style> .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }   2- Create the view button (TargetControlID) as you know this contain the ID of the element that activates the modal popup: <asp:Button ID="btnView" runat="server" Text="View" /> .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }   3-Add the ModalPopupExtender ,moreover don’t forget to add the ScriptManager: <asp:ScriptManager ID="ScriptManager1" runat="server"/> <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnView" PopupControlID="panModal" CancelControlID="btnCancel"/> .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }     4-In the pageLoad javascript function inside add_shown event set the focus on the txtName , and inside add_hiding reset the two Textboxes. <script language="javascript" type="text/javascript"> function pageLoad() { $find('ModalPopupExtender1').add_shown(function() { alert('add_shown event fires'); $get('<%=txtName.ClientID%>').focus();   });   $find('ModalPopupExtender1').add_hiding(function() { alert('add_hiding event fires'); $get('<%=txtName.ClientID%>').value = ""; $get('<%=txtPassword.ClientID%>').value = "";   }); }   </script> .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }   I’ve added the two alerts just to let you show when the event fires.   Hope this simple example show you the benefit and how to use these events.

    Read the article

  • Event OnClick ASP:LinkButton not firing with jquery overlay

    - by rolando
    Hi there, So i have this: <asp:LinkButton runat="server" id="lkbTomeChichi" class="modalInput contratacionVinculos" rel="#prueba" OnClick="PruebaBrava" >LinkPrueba</asp:LinkButton> <div id="prueba" class="simple_overlayFondoBlanco" style="margin: auto; z-index: 99;"> hola como está todo ;) </div> and i have this: <script type="text/javascript"> function pageLoad() { var triggers = $("a.modalInput").overlay({ // some expose tweaks suitable for modal dialogs expose: { color: '#333', loadSpeed: 200, opacity: 0.3, zIndex: 99 }, top: '25%', closeOnClick: true }); } </script> as you can see i'm using a LinkButton who transforms into an 'a' tag on rendering so jquery pageLoad function can use it to show an overlay. My problem is i need the 'OnClick="PruebaBrava' to execute before the overlay shows. If i use a button instead of a LinkButton it works perfectly but i need to use the linkbutton and with it that event is not firing. What can i do? Thankyou all very much for your answers ;)

    Read the article

  • JQuery click anywhere except certain divs and issues with dynamically added html

    - by jCuga
    I want this webpage to highlight certain elements when you click on one of them, but if you click anywhere else on the page, then all of these elements should no longer be highlighted. I accomplished this task by the following, and it works just fine except for one thing (described below): $(document).click(function() { // Do stuff when clicking anywhere but on elements of class suggestion_box $(".suggestion_box").css('background-color', '#FFFFFF'); }); $(".suggestion_box").click(function() { // means you clicked on an object belonging to class suggestion_box return false; }); // the code for handling onclicks for each element function clickSuggestion() { // remove all highlighting $(".suggestion_box").css('background-color', '#FFFFFF'); // then highlight only a specific item $("div[name=" + arguments[0] + "]").css('background-color', '#CCFFCC'); } This way of enforcing the highlighting of elements works fine until I add more html to the page without having a new page load. This is done by .append() and .prepend() What I suspected from debugging was that the page is not "aware" of the new elements that were added to the page dynamically. Despite the new, dynamically added elements having the appropriate class names/IDs/names/onclicks ect, they never get highlighted like the rest of the elements (which continue to work fine the entire time). I was wondering if a possible reason for why my approach does not work for the dynamically added content is that the page is not able to recognize the elements that were not present during the pageload. And if this is a possibility, then is there a way to reconcile this without a pageload? If this line of reasoning is wrong, then the code I have above is probably not enough to show what's wrong with my webpage. But I'm really just interested in whether or not this line of thought is a possibility.

    Read the article

  • Repeater vs. ListView

    - by MoezMousavi
    I do really hate repeater. I was more a GridView lover but after 3.5 be born, I prefer ListView.  The first problem with Repeater is paging. You will need to write code to handle paging. Second common problem is empty data template. Have a look at this:             if (rptMyRepeater.Items.Count < 1)             {                 if (e.Item.ItemType == ListItemType.Footer)                 {                     Label lblFooter = (Label)e.Item.FindControl("lblEmpty");                     lblFooter.Visible = true;                 }             }   I found the above code is usefull if you need to show something like "There is no record" is your data source has no records. Although the ListView has a template.   If you combine ListView with a DataPager, you will be in heaven as it is sorting the paging for you without writing code. (http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.datapager.aspx)     Note: You have got to bind ListView in PreRender, it doesn't work properly in PageLoad   More: http://www.4guysfromrolla.com/articles/061009-1.aspx

    Read the article

  • How can I have a mouseover/in one off check?

    - by Denis Hoctor
    Hi all, How can I test if a mouse is within a given div? I know how to use events to do something when it occurs but is it possible to check it on pageload only? What I want to do is smething like: if(mouse is in specified div) { check = true; } else { check = false; } Thanks, Denis

    Read the article

  • ASP.NET Membership - Login Control - TextBox Focus

    - by Steve
    I know this seems to be a very basic questions but I can't figure out how to give the textbox the focus on PageLoad. Since this is a Login Control, I have no individual control over each textbox thru code the way I am used to it. Does anyone happen to know how to give focus to the control please. Steve

    Read the article

  • Push link inside html using javascript

    - by vetri
    I have a div tag <div id="img"> <div> and a script in page <script type="text/javascript"> function img(){ document.getElementById('img').innerHTML="<a href="/lime/link.html"><img src="/lime/img.png"></a>";} </script> how to put the image on the div with link on pageload.

    Read the article

  • Selecting the contents of an ASP.NET TextBox in an UpdatePanel after a partial page postback

    - by Scott Mitchell
    I am having problems selecting the text within a TextBox in an UpdatePanel. Consider a very simple page that contains a single UpdatePanel. Within that UpdatePanel there are two Web controls: A DropDownList with three statically-defined list items, whose AutoPostBack property is set to True, and A TextBox Web control The DropDownList has a server-side event handler for its SelectedIndexChanged event, and in that event handler there's two lines of code: TextBox1.Text = "Whatever"; ScriptManager.RegisterStartupScript(this, this.GetType(), "Select-" + TextBox1.ClientID, string.Format("document.getElementById('{0}').select();", TextBox1.ClientID), true); The idea is that whenever a user chooses and item from the DropDownList there is a partial page postback, at which point the TextBox's Text property is set and selected (via the injected JavaScript). Unfortunately, this doesn't work as-is. (I have also tried putting the script in the pageLoad function with no luck, as in: ScriptManager.RegisterStartupScript(..., "function pageLoad() { ... my script ... }");) What happens is the code runs, but something else on the page receives focus at the conclusion of the partial page postback, causing the TextBox's text to be unselected. I can "fix" this by using JavaScript's setTimeout to delay the execution of my JavaScript code. For instance, if I update the emitted JavaScript to the following: setTimeout("document.getElementById('{0}').select();", 111); It "works." I put works in quotes because it works for this simple page on my computer. In a more complex page on a slower computer with more markup getting passed between the client and server on the partial page postback, I have to up the timeout to over a second to get it to work. I would hope that there is a more foolproof way to achieve this. Rather than saying, "Delay for X milliseconds," it would be ideal to say, "Run this when you're not going to steal the focus." What's perplexing is that the .Focus() method works beautifully. That is, if I scrap my JavaScript and replace it with a call to TextBox1.Focus(); then the TextBox receives focus (although the text is not selected). I've examined the contents of MicrosoftAjaxWebForms.js and see that the focus is set after the registered scripts run, but I'm my JavaScript skills are not strong enough to decode what all is happening here and why the selected text is unselected between the time it is selected and the end of the partial page postback. I've also tried using Firebug's JavaScript debugger and see that when my script runs the TextBox's text is selected. As I continue to step through it the text remains selected, but then after stepping off the last line of script (apparently) it all of the sudden gets unselected. Any ideas? I am pulling my hair out. Thanks in advance...

    Read the article

  • Display Pdf Stream on page load with Binary Write

    - by Israfel
    I have a pdf file being generated on the fly which I want to display inline on pageload, as below Response.Clear() Response.AppendHeader("Content-Disposition", "inline; filename=_Bulk_Print.pdf") Response.ContentType = "application/pdf" Response.BinaryWrite(docData) Response.End() If I put this in a click event it works perfectly but when on page load I Just get a blank aspx page despite the fact it's stepping through that code and the generation of the DocData no problem. Does anyone know the reason for this or a workaround, thanks for your help.

    Read the article

  • how can a firefox extension detect content-type of the page loaded ?

    - by bosky101
    since my extension's pageload is triggered even when I view css or js files, i want to add another check that triggers my extension only when the current page's content-type is text/html . //eg: at my page load handler function onPageload(){ // only want to proceed if content-type reflects a text/html or */html page if ( contentTypeIsHtml() ){ //continue here } } what should contentTypeIsHtml() do ?

    Read the article

  • 398 row datalist slowing down modal open????

    - by Jreeter
    Hey guys I got a weird issue.. I have a datalist that's only loaded on pageload it contains 2 columns a name and date and has 398 rows.. In IE 7 and above(and prob previous version) when I open a modal via a button click it takes almost 5 seconds to open. HOWEVER, if I do not bind this datalist it's MUCH faster.. Also this is only happening in IE, Chrome, Firefox and opera both open the modal instantly with the datalist binded... Josh

    Read the article

  • Control is set to false, jQuery selector fails

    - by Damien Joe
    Hi I have some controls on an asp.net modal which I show manually via code behind. Now I am trying to attach a selector on one of the controls inside pageLoad(), problem being is that the modal container is initially set to visible=false. I tried checking for length but it still throws exception if ($('#<%= myControl.ClientId %>').length > 0) { $('#<%= myControl.ClientID %>').click(function() { // Do work }); } Compiler Error Message: CS0103: The name 'myControl' does not exist in the current context

    Read the article

  • fadeIn on page load

    - by Brad
    I want to fade in a background of an entry within a div - this is to show the user what the most recent entry is on page load. I want it to do it on page load, without having to click or hover or anything, just when the page loads. I have this: $(document).ready(function() { $('#box').fadeIn(5000, function() { // Animation complete }); }); Is it something like pageLoad? Any help is appreciated.

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >