Responding To ActionResults With JQuery?

Jan 3, 2011

I know how to respond to a form post in ASP.NET MVC using jQuery, but I'm having trouble with something that is a little bit more simple.

The scenario is that there is a list of items on the screen, like an ordered list.

<ul>
<li>Item 1</li> // each will corrospond with an id.
<li>Item 2</li>

This is a crude example, of course, but the basic jist is that when the user clicks one, it will perform some server side logic... so in the controller, there is a method such as ..

public bool CheckSomething(int id)
{
// do some logic to determine if the result should be true
return true;
}

It's very simple logic, really - but it still requires database access, so I cannot do it in javascript. I need to have it hit my controller. The problem is that I want the UI to respond to this. how to exactly wire this up without using a Form.

View 2 Replies


Similar Messages:

JQuery Replaced Div Stops Responding To Mouseclick

Nov 9, 2010

I am trying to replace a value in a drop down box. The replacing works fine (after help from this fine community) but afterwards the slide function stops working. I can't find any errors so I'm asking if this could be related to how jQuery and javaScript works? Are elements "mapped" to the DOM on load and if so; would that imply that replacing a div with another div would result in jQuery loosing track of the divs? I use this code to check if a div is clicked:

$(document).ready(function () {
$('.button_slide').click(function () {
var num = $(this).attr('rel');
$('div.content_slide:not(.' + num + ') ').slideUp(400);
$('div.' + num).slideToggle(400);
});
return false;
});

This is the div:

<div class="button_slide" rel="slide1">Alts:</div>
<div class="content_slide slide1">
<input id="Button1" rel="slide1" class="button_vertical click_button" type="button" value="2" size="10px" />
<input id="Button2" rel="slide1" class="button_vertical click_button" type="button" value="3" />
</div>

This is the jQuery that drops down the box:
$(function () {
$('.click_button').click(function () {
var num = $(this).attr('rel');
$('.button_slide[rel="' + num + '"]').replaceWith("<div class='button_slide' rel='" + num + "' >" + $(this).val() + "</div>");
$('div.content_slide').slideUp(600);
});
});

I'm pulling my hair on this one and jQuery isn't my stronger side... How would you solve this?

View 4 Replies

Can Add Different ActionResults For The Same Page

Mar 23, 2011

I've researched this before asking, but all I can find is trivial apps that all use the same type of example. My first, of many, questions involves Controllers->Views.

Of all of the examples I have seen they always return one view. For example, the Home/Index control will return a view like so: return View(model); But, what if you need multiple views for the same page? Say you have to return two pieces of data, for other parts of the page, would you need to add all control logic in the single Index Controller View(), or can I add different ActionResults for the same page?

View 18 Replies

Images Via IIS Or Controller ActionResults?

Nov 5, 2010

I have an ASP.NET MVC2 application that is maintaining a library of about 10GB of images. Many of these are customized by the application. We had been storing these in SQL but for a number of reasons, we are moving our images to the file system.

The file system vs SQL issue aside, should I be serving up my images through ActionResults on Controllers or directly serving them up via IIS and a separate web site? The former offers a number of advantages such as control over caching and some dynamic redirection but I would assume directly accessing files via IIS will be more efficient. How big an efficiency hit will I take serving up the images myself?

View 3 Replies

MVC :: 2 ActionResults Both Doing Seperate Things?

May 20, 2010

I have 2 ActionResults both called Create which basically create different things on a model. Is there a way to have overridden action results? - I dont quite follow routing and not sure how to do what I'm trying to do.When creating A i call :-

AcceptVerbs(HttpVerbs.Post)]
public
ActionResult Create(ProjectModel

[code]...

View 1 Replies

Responding To A Text Message Using .NET?

Jul 16, 2010

I'm interested in creating a service that will receive a text message and based on it's content send a text message back to the original number. I've looked around a little bit but haven't found any good resources for information on how to do this.

Can anyone point me to any good links to find some info on this or recommend what .NET libraries I should investigate first?

View 1 Replies

Configuration :: Application Not Responding

Sep 29, 2010

Recently our client's server was having ASP.Net application not responding issue and after restarting the server, IIS seems back to normal. We found the following error in event viewer and suspected it caused the problem.

Faulting application avp.exe, version 6.0.4.1212, time stamp 0x4ab901f6, faulting module MSVCR80.dll, version 8.0.50727.3053, time stamp 0x4889d619, exception code 0xc0000005, fault offset 0x0001500a, process id 0x0a0, application start time 01cb3f860132e1d6.

Would this error cause the IIS become not responding? As the user can't access the ASP.Net application, and the page just keep loading. However, the other JSP application running on tomcat was working fine.

View 4 Replies

VS2010 Debugger Not Responding

Jul 19, 2010

I am working on a large website that is comprised of multiple applications. We are still using web forms. All of the applications are in a common directory that serves as the root directory in my localhost. The site was originally built in 2005 on 3.5 but has been migrated to 2010 still running on 3.5 (2.0). My problem is that my debugger will run once. After I stop debugging I cannot run the debugger again - it just hangs. My locals and watch windows open but do not populate and the browser never opens. We are running Visual Studio 2010 Ultimate on Windows 7 32 bit.

View 1 Replies

C# - How To Cancel A Web Service Call If It's Not Responding

Apr 8, 2010

I have a web page (.aspx) that calls a third party web service to get some data. It usually takes couple of seconds to get the response back, and then the rest of the page will load. Occasionally the call gets stuck either due to the web service is down, or internet connection, etc., the page just hang there and will not load.

My questions is:

1) Is there a way to abort/cancel the web service call after a set amount of time?

2) Is it even possible to verify the status of the web service before calling it?

View 2 Replies

MVC :: IIS Responding With 404 On HTTP HEAD Request?

Jul 28, 2010

I'm currently trying to setup testing with Selenium. It seems that Selenium sends a HEAD request to my route /Home/Index before it sends the GET request. This causes all my tests to fail. I was wondering how I would go about getting HEAD requests to respond correctly (not 404).

View 3 Replies

Aspx Page With A Reference To A Dll Not Responding?

Jun 9, 2010

I have published a aspx website in IIS 5.1. My second page refers to a .dll file of a vb6 program.My backend program is written in c#.At first when I published i couldnt load my second page as I got an error saying that I have to register external com objects....

so I registered the dll file in my root directory using "regsvr32 ". Now after registering im able to access that page, but the buttons are not responding. When I click the buttons on the page the refer to functions in that dll. But its waiting for localhost to respond for a long time and im not getting the results.

View 7 Replies

ADO.NET :: Timeout Expired - Server Is Not Responding?

Mar 23, 2011

I am working on one application and it has report functionality in it. i have one stored procedure which is doing some calculation and inserting whole calculation in one table and then that table will show up in one report..this insertion procedure may have to insert 5000 number of records or more than that so while my stored proceudre is executing that calculation and insertion part, my application is thorwing below exception :

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.i have set timeout in web.config i.e. timeout=10000000...still throwing an exception

View 7 Replies

Configuration :: .Net Server Not Responding To Some Postbacks?

Oct 25, 2010

I am working int a .net 1.1 framework with Visual Studio 2003. I have 3 different servers being used. The first is a development, then a staging, and finally a production server. My problem is that on a couple of my pages buttons that are linked to functions are not getting responded to by the server on the development. I have used breakpoints in init, onLoad, and the funciton that is bound to the click even. This is only happening on a couple pages. I originally thought that this was a fault in the code on those pages, but I built the website and pushed the files and .dll out to the staging server and it works fine. I have tried to enable tracing, but that only shows the information on the postback, which the server is just not responding to in this case. I have reinstalled IIS thinking that something there could have been corrupted.I have also looked at event logs on the development server as well as the sql server that it is pulling from to no avail.

View 1 Replies

Web Forms :: DetailsView Not Responding To DropDownList?

Mar 12, 2010

My DetailsView is bound to a table where I have a DDL (drop down list) where the selection queries the DetailsView. I tworks except for when I try to select the first item (after selecting other items). It doesn't query the first selection. But it queries the other selections.

View 5 Replies

C# - Preventing A Button From Responding To 'Enter'?

May 13, 2010

I have a master template that all the pages on my site use. In the template there is an empty panel. In the code-behind for the page an imagebutton is created in the panel dynamically in my Page_Load section (makes a call to the DB to determine which button should appear via my controller). On some pages that use this template and have forms on them, pressing the Enter key fires the click event on this imagebutton rather than the submit button in the form. Is there a simple way to prevent the imagebutton click event from firing unless it's clicked by the mouse? I'm thinking a javascript method is a hack, especially since the button doesn't even exist in the master template until the button is dynamically created on Page_Load (this is ugly since I can't simply do <% =btnName.ClientId %> to refer to the button's name in my aspx page).I tried setting a super-high tabindex for the image button and that did nothing. Also set the button to be the DefaultButton in its panel on the master template but that did not work either. Moreover, I don't want to add a property to all of my pages that use this template (there are hundreds). It would be optimal to find a solution that works globally from my master template.I'll try to show our example here:We have a button on the top of each page in our system that lets you star the page as one of your favorites, sort of a server-side bookmark system. When the page loads it looks to see if the page is one of your favorites or not and then shows a gold star if it is, and a gray star if it is not. Clicking the imagebutton of a star toggles the page favorite status.In my master template (FullMenu.master) I have this panel

<asp:Panel runat="server" ID="pnlFavorite" style="display:inline;"></asp:Panel>

Next there is a class which creates the button and adds it to the panel on the master template:

public void InsertStarButton()
{
CreateStarButton();

[code]....

View 2 Replies

Databases :: A MySql Error Causes Web-app Stop Responding?

Feb 7, 2010

I am working on an ASP.NET C# web application in Visual Web Developer Express 08', with MySql database.

Everything works just fine, except one problem that drives me crazy for few weeks...

My application randomaly (or not) stop responding, or just freezing for couple of minutes.

I am sure that the problem is connected somehow to my connection with MySql db.

In the debug window in VWD I get over and over the line:

"A first chance exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll"

Note that in each page load I call a function that kills all sleeping MySql connections, so I don't really think that my problem is 'too many connections'.

The error isn't constant, and not occures only in one page, it occures in many pages (that contains mysql access code), randomaly.

View 1 Replies

Web Forms :: Parent User Control Not Responding?

Jul 15, 2010

I have this weird problem. I have an aspx page which contains a User Control(Parent). This Parent User Control contains another User Control(Child). Now, when i run my website it works ok until I have make some event inside the child control, at this moment the parent control stop responding!!!. The child user control appears and loads data correctly but when I try to do something inside it, the parent user control stop working correctly.

View 3 Replies

Security :: Application Using AD Form Authentication - Login Not Responding

Aug 23, 2010

I've encountered a problem with intranet ASP.NET Application using AD Form Authentcation. The login and authorization is built using this KB http://support.microsoft.com/kb/316748. It works fine on DEV but not in UAT and PROD.

Basically, the problem is:1. In DEV, users see login page and they enter domain user name and password and login process happens with no issue.

2. But in PROD and UAT, the same application when the users see the login page (first time) and they submit the login form no response. The login button does nothing. The user closes the browser and come back to login page and it works second time. Strange, this doesn't happen in DEV.

3. Further, on DEV by changing the LDAP path to PROD or UAT, the users can still login the first time. It's only the PROd and UAT that seems to be a problem. Not sure whether it's IIS setting or domain policy or something else.....

Not sure what's causing this issue. The only difference that I can see between DEV and UAT/PROD is:

1. DEV has no load balance but UAT and PROD has.

2. In DEV application is installed under Default Website and on PROD/UAT it's under new website.

The IIS settings has been setup as per given KB. I

View 1 Replies

AJAX :: Checkbox Not Responding Inside Update Panel C#?

Feb 24, 2010

I have a check box, RequiredFieldValidator and textbox that have editmask extender I want to change the control properties programmatically when I check the check box but the problem that nothing happened when I check it.

I made the control post back and I added triggers.

when put break point and go with code step by step will go through the code but nothing change.

<asp:UpdatePanel ID="UPanelContacts" runat="server">
<ContentTemplate>
<asp:Panel ID="PContactsInfo" runat="server" GroupingText="Personal Information"
BorderStyle="Dotted" Style="position: absolute; top: 103px; left: 221px; height: 468px;
width: 811px; margin-top: 69px;">
<asp:TextBox ID="txtHomePhone" runat="server" Style="top: 147px; left: 543px; position: absolute;
height: 22px; width: 128px" AutoPostBack="True" ></asp:TextBox>
<cc1:MaskedEditExtender ID="txtHomePhone_MaskedEditExtender" runat="server" CultureAMPMPlaceholder=""
CultureCurrencySymbolPlaceholder="" CultureDateFormat="" CultureDatePlaceholder=""
CultureDecimalPlaceholder="" CultureThousandsPlaceholder="" CultureTimePlaceholder=""......

View 10 Replies

Visual Studio :: 2010 - Not Responding / Not Able To Close The Page?

Jun 25, 2010

I upgraded from VS2008 to VS2010. If I modify an aspx page that I created in VS2008, I am not able to close the page. Visual Studio 2010 becomes not respond. I am using Windows 7 and Telerik tools. Do you know why this is?

View 2 Replies

MVC :: Validation / Getting Firefox Error 'MicrosoftMvcValidation.js :29 Busy Or Stopped Responding'

Jun 16, 2010

I am trying to validate an email address in a textbox, but when I try to type into the textbox, after I have typed more than about 10 characters, I get the Firefox error 'MicrosoftMvcValidation.js :29 Busy or stopped responding'. Here is my code,

Model :

[Code]....

View :

[Code]....

View 1 Replies

Forms Data Controls :: Gridvew Pager Next Button Not Responding?

Sep 22, 2010

I implemented the class from this link below: http://gonzalo.name/blog/and when I click on the next button image in the pager row, it does not go to the next page, same thing happens when I change a number in the text box, it does not respond. I stepped through the debugger and it does go to the onNextClicked event but does not do any thing. I have a custom grid control and the only thing different then the instruction is rather than using the page_int event I am using the gridview1_init event for this linegridview1.pagertemplate = new fancypagertemplate)gv);I was just wondering if some one has successfully used this code before? Or what other steps could I take to debug this issue?

View 2 Replies

Would A Browser Ever Ignore Case Sensitivity Of The Location Header When Responding To A Redirect

Sep 3, 2010

If a browser requests http://site.com/?q=abc

and gets a 301 redirect response to location http://site.com/?q=ABC (note case of querystring)

Is it possible for the browser to ignore the difference in case and re-request http://site.com/?q=abc, thus causing an infinite redirect loop?That's the scenario that appears to be happening according to the IIS logs. It seems to be isolated to Internet Explorer with some variation of the Ask toolbar installed (based on user-agent values). I even installed the Ask toolbar, but have not been able to recreate this scenario in any way.

I can't post the source code, but for those that want something, here's the general logic:

Page_Load(object sender, EventArgs e)
{
var q = Request.QueryString["q"];[code]...

As you can see, if this page is requested with ?q=abc it will be redirected once, but then it'll render as usual because the redirect goes to ?q=ABC.Is there any scenario where the browser (specifically IE with the Ask toolbar) could ignore the case of the redirect location, causing an endless loop?

View 2 Replies

Forms Data Controls :: Buttons In GridView Stop Responding After Several Clicks

Mar 25, 2011

I have a gridview control to which I bind some data.In my gridview, i have a bound column and a Template field which contains a Button and sets the command argument for the button.

[Code]....

My OnCommandEvent is as follows:

[Code]....

View 2 Replies

HttpHandlers / Modules :: Global.asax Application_BeginRequest Not Responding To Http Head Request?

Apr 2, 2010

I am doing some redirecting of old url in global.asax's application_beginrequest. Redirecting works fine when getting the url's using an http get but not when using an http head request.

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved