.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

jQuery Event not Firing..

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :ASP.Net

Hi Guys,

Have a problem.. to which I don't seem to see the reason as to why :).

I have a View with a dropdownlist which is populated with country names from a ViewBag. No problem there. When the user changes the item, the event is not observed. Can you see anything which stands-out, which may be a contributing factor to my encountered problem?


<script type="text/javascript" src="../../Scripts/jquery-1.4.4.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('#Countries').change(function () //wire up on change event of the 'country' dropdownlist
            var selection = $('#Countries').val(); //get the selection made in the dropdownlist
            $('#results').load("/Locations/Sites/" + selection); //return value of hte url /locations/sites which is the action method to invoke.

    Ajax.BeginForm("Sites", new AjaxOptions { UpdateTargetId = "results" });
    ViewBag.Title = "Create Location";
    Layout = "~/Views/Shared/_Layout.cshtml";
    <legend>Create new Location</legend>
        <div id="country">
            @Html.DropDownList("Countries", ViewBag.Country as SelectList, "", new {@style = "mar

View Complete Post

More Related Resource Links

jquery click event doesn't fire after postback anymore

Hello there,I have a small website where I want to display a confirmation dialog after clicking on a button.When you click the confirmButton the dialog appears. Then you can choose between Yes or No to either continue with the PostBack or to return.Problem: The first time you get into the site all works fine. But after you click Yes to continue with the PostBack, no click event will be triggered anymore.Here is some code.<asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <script type="text/javascript"> function loadConfirmDialog() { //Dialog configurieren jQuery('#confirmDialog').dialog({ autoOpen: false, width: 400, modal: true, resizable: false }); //Dialog öffnen jQuery('#confirmButton').bind('click', function () { jQuery('#confirmDialog').dialog('open'); return false; }); //Postback ausführen jQuery('#continueButton').bind('click', function () { jQuery('#confrimDialog').dialog('destroy'); __doPostBack('confirmButton', ''); }); //Postback abbrechen jQuery('#cancel

MouseUp event not firing on ActivityDesigner class?

I have a custom control derived from ActivityDesigner.  I'm basically retemplating the contol to give it a stylized look and feel ... I want to add the ability to change the Display Name by swapping out the TextBlock with a TextBox on MouseUP - but this event is not firing. I can handle the MouseDown event and it works OK, except it enters the Edit mode when dragging the activity around.  Is the MouseUp handled at the base level?  Is there a way to work around this? 

Disable Login event firing in SP 2007

hello, how can i disable the login event firing in sharepoint ?...i just want to disable the sign in event 

Sharepoint Event Handler not firing

I have written an event handler for an ItemAdded eventfor a document library. I am trying to read an excel file being uploaded and extract a value from it which I write to a list column for the item. I have this working properly on my development machine which is a Windows Server 2003 machine.However, on a production Windows Server 2008 machine, the event handler never fires. I am doing a simple write to a log file to test and see if it runs at all even if the Excel parsing does not work but I get no indication that it ran. The event handler is being registered with a feature that I am deploying. I have verified that the event handler is registered to the library by using the u2u Event Handler Explorer tool.Is there any way I can determine if my event handlers are even executing? How can I debug this?

ItemAdded Event Handler not firing

Hi, I have created an ItemAdded Event handler that is linked to a content type. This event handler does certain custom validations and then sends Email to users. I have referenced this event handler in XML file as well but somehow the event handler is not getting fired...Following is the code.   Code Snippet            this.DisableEventFiring();            using (SPSite site = new SPSite(properties.SiteId))            {                 using (SPWeb web = site.OpenWeb())                {                    base.ItemAdding(properties);                     SPList nList = web.Lists["NList"];                    SPList IList = web.Lists["IList"];                     foreach (SPListItem listItem in nList.Items)                    {                        if (listItem["Topic"].ToString() == properties.ListItem["Topic"].ToString())                        {                            SPUser alertUser = (SPUser)(properties.ListItem["SUser"]);                            SPUtility.SendEmail(web, false, true,alertUser.Email,"New item added", "A new item has been added");                         }                    }                    this.EnableEventFiring();                }            }       The XML file is: Code Snippet  <XmlDocuments>      <XmlDocument NamespaceURI="http://schemas.microsoft.com/

Get dropdownlist event OnSelectedIndexChange using jquery

I have dropdownlist that located inside a repeater, how can i get OnSelectedIndexChange event of this dropdownlist? i want to use this event to set TextBox value olso inside this repeater, i try this code$("#Table1> tbody > tr ").each(function() { var rowId = $(this).attr("id"); $(this).find("td > #DropDownList1").change(function() { $("#" + rowId + "> TD:nth-child(6) > input[name$='TextBox1']").val("Test"); }); }); But did not work, can anyone please help me?

click event only firing for lower 100 pixel portion of vertical div

 I have a div on the left side of my page. when clicked I toggle a hidden div that flies out to the right. But the click event only works on the bottom portion of the div. The hidden div has a close button div in the lower right. to clicks fine. any ideas? code is below jquery <script type='text/javascript'> $(document).ready(function() { var $scrollingDiv = $("#divReportBanner"); $(window).scroll(function(){ $scrollingDiv .stop() .animate({"top": ($(window).scrollTop()) + "px"}, "fast" ); }); $('.toggle-button').click(function() { $("#divLeftMenuBody").animate({width:'toggle'},400); }); $('#divReportBanner').click(function() { $("#divLeftMenuBody").animate({width:'toggle'},400); }); }); </script> html <div id="divReportBanner" ></div> <div id="divLeftMenuBody" runat="server"> <div style=" overflow: scroll; overflow-x:hidden;width:365px; height:370px;">

On click Dialog Box to browse file...NOt firing serverside event...

<script type="text/javascript">    function Open()    {         var fileupload=document.getElementById('fupload');                      fileupload.click();  //       document.form1.submit();    }       </script>protected void Page_Load(object sender, EventArgs e)    {btnimport.Attributes.Add("onclick", "javascript:return Open();");    }<asp:Button ID="btnimport" OnClick="btnimport_onclick" runat="server" Text="Import"/>                                                        <input type="file" runat="server" style="display: none" id="fupload" />protected void btnimport_onclick(object sender, EventArgs e)    {        if (ViewState["CurrentTable"] != nu

List Event Receivers firing for all custom lists

Hello, I have a site with two custom lists, and I have created an EventReceiver class to handle the ItemAdded event for custom lists. I have modified the EventReceiver's Elements.xml file to only handle items added to one of the custom lists instead of all custom lists, by changing: <Receivers ListTemplateId="100"> to <Receivers ListUrl="/Lists/MyCustomList">   however, when debugging, the ItemAdded method is being fired when an item is added in both custom lists. I have had to work around this by checking within the ItemAdded method for the list that fired the event:        public override void ItemAdded(SPItemEventProperties properties)        {            base.ItemAdded(properties);            if (properties.ListTitle.Equals("My Custom List")) { ... } I thought the ListUrl attribute of the Receivers element specifies the event to only fire for the specific list with that url? (see http://msdn.microsoft.com/en-us/library/ms431081.aspx). Is there somewhere else I should be checking?   Thanks

Drop Down Listbox SelectedIndexChanged Event not firing when I programmatically change selection

I have two drop down listboxes (DDL1 and DDL2).  When DDL1 has an index change, DDL2 then has a refresh of list items based off SQL Server SELECT from a table.  The database isn't the problem.  Everything works perfectly when the user selects a new item manually from DDL1.But in my code, I save the user data from the selection of DDL1 in a separate table.  And then upon rendering of the page (Page_PreRenderComplete), I do a SelectedIndex assignment of the value of what's saved in the db table.  That works just fine, it selects the DDL1 item, but DDL2 is unaffected, as if DDL1's SelectedIndexChanged event isn't called like it would be if manually changed.  How can I get around this?Thanks in advance. :)

button event using jquery

 I have a button control that need to show a div when clicked. I wrote the following code, however is not working. I am new to jquery and wanted to use the "show()" function. Please advise.   <html> <head> <script src="jsquery.js" type="javascript"></script> <script type="javascript">   Function showdiv()   {    $('#<%=btn1.clientid%>').click(function() {        $("#div1").show("slow");       });     }    </script> </head> <body> <asp:button id="btn1" runat="server" text="Show" onclientclick = "showdiv()"  /> <div id="div1" style="display:none;"> <p>Hello World</p> </div> </body> </html>        

ProcessCmdKey event not firing

I have a fairly involved form that is composed of a lot of telerik controls and also has a ChartDirector chart in it.  I am trying to manipulate a cursor in the chart that will skip from one point to another, and I want to use the arrow keys as one method to move the cursor. I have overridden the ProcessCmdKey event in the Form class that hosts all the controls, and it never fires in my application (I put in break points to be sure).  I have tested the exact same code in a newly created RadForms object that also included similar controls (though not as extensive), and it works just fine.  My conclusion is that there is another event that gets fired first and is intercepting the information before ProcessCmdKey sees it. Is this a reasonable assumption, and if so, does anyone know which event might be being fired and know of a way to check what it's doing?  This single form has a few thousand lines of code, and a truckload of event handlers, so excising them one by one will be time consuming. thanks, David

how to call a function or event using jquery Ajex

<asp:Button id="Bu_DocShareSave" runat="server" Text="Save Share" OnClick="Bu_DocShareSave_Click"/>protected void Bu_DocShareSave_Click (object sender, System.EventArgs e){            string S_DocShareID=CCUtility.ToSQL(Utility.GetParam("txt_DownloadFileID"),FieldTypes.Number);            string S_DocStorage=CCUtility.ToSQL(Utility.GetParam("dbo_Storage"),FieldTypes.Text);            string S_DocShareToEmp=Utility.GetParam("dbo_Emp");            string[] SA_DocShareToEmpSplit = S_DocShareToEmp.Split(',');                        int a=0;                         foreach (string Empid in SA_DocShareToEmpSplit){                        if(!Empid.Equals(""))                   {                      

JQuery Autcomplete with blur event on Html.TextBoxFor

Hello,                 I have a strange problem in my application.whenever i select a suggestion from the autocomplete(jquery) textbox, it first fires a blur event of a textbox first.(When i click the suggestion using mouse). But i want to fire blur event later.What should i do?Please help.   thanx in advance.  

KeyDown event on a Form is not firing for STX and/or ETX

I'm using a wireless barcode reader that's inputting data using HID. I've configured it to wrap the output between STX and ETX (0x02, 0x03), however, i never get any KeyDown event generated when those keys are sent from the device, the barcode keys are sent just fine but not STX and ETX.

FormView Command Button not firing Item Command Event

Hi, In my content page, I have a formview for Insert & Edit. In insertitemtempalteI have a command button (btnInsert) to trigger  Item_Command event to insert a new record. The button event never gets triggered. But If I set CausesValidation = "false"it fires. But I want the validation to take place. I tried btnInsert_command and btnInsert_Click events. None of them is fired. Ideally I would like to havethe item_command event fired. I would appreciate any inpyt on how to handle this problem. <FormView>     <InsertItemTemplate>            .....           <div>               <asp:Button id="btnInsert" CommandName="Insert" Text="Insert" runat="server" UseSubmitBehavior="true" />              <asp:Button id="btnCancel" CommandName="Cancel" Text="Insert" runat="server" />           </div>     </InsertItemTemplate></FormView>   Thanks Suresh

dynamically created button control click event not firing first time?

HI im creating a button control in page int and im assing a click event for the button control. here the click event is not firing for the first time.can anyone help me with this? here is my code. Button btn = new Button(); btn.ID = "btn"; btn.Click += new EventHandler(btn_Click); Panel1.Controls.Add(btn); Panel1.Controls.Add(new LiteralControl(""));
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend