JQuery Method Not Working Second Time?
Mar 24, 2011I have a JQuery Method. When I click on button "btnSelectDisclosure", a popup appears but only once. Not for next time.
[code]...
I have a JQuery Method. When I click on button "btnSelectDisclosure", a popup appears but only once. Not for next time.
[code]...
I'm trying to call an action method in an MVC application using jQuery. Basically what I want is to take the value of a couple of input fields and call the action method by clicking a button, passing the values of the input fields as parameters. But I only get the value of the "number" parameter, not the "year" parameter.
function selectWeek() {
$('#selectWeekButton').click(function (event) {
var number = $("#selectWeekId").val();
[code]...
I checked the url with an alert, as you can see, and it seems to contain both values fine. But when I check the value of the year parameter in the action method it is null.Here are the input fields:
<span>Vecka: </span>
<input type="text" id="selectWeekId" />
<span>År: </span>
<input type="text" id="selectYearId" />
<input type="button" value="Välj vecka" id="selectWeekButton" />
And the beginning of the action method:
public ActionResult Edit(string number, string year)
//etc...
I know that this looks like a strange thing to do instead of just binding fields, but the reason is that these input fields and their values is not the main purpose of this View. They're just there to select another week in this timesheet application. And besides, I'm going to replace the input fields with a jQuery calendar eventually, so I will still have to do something like this.
So what's the easiest way to do this, and why isn't it working as it is?
i working in asp.net mvc project and deployed in the windows 2003 with iis 6.server.But it post method in jquery is not working after hosting. it given all path of the script is correct with Url.Content. The same Project hosted working in xp with iis5.1 it working fine.Give me any solution to run post of the jquery in the hosting server windows 2003.
View 2 RepliesOK Here is the situation:
I have a web app with a table of statistics on our salesmen's customers, and each row has a sparkline graph showing the general trend of the sales data for the last 12 months. Each page shows a particular salesman's customer list, and some of them can have an enormous number of customers = an enormous number of rows = an enormous number of sparklines (e.g. one in particular has 125 and takes 15 seconds to load).
For this reason, jQuery sparklines could not be used - they completely pinned the CPU of a user accessing a page with a lot of sparklines with IE.
So I moved on to using the Google Chart API, which worked much better, except for two issues: 1) it's on a secure site, and the Google Chart API URL is only served over HTTP (solved by using a small wrapper script to download the graph dynamically and re-serve it from our secure server); and 2) on a page with 125 sparklines, it was still very slow due to the number of requests (even when the 0-9 server prefixes are used to maximize the # of available connections).
So my next step beyond this was to try to make each of the "download/grab/re-serve image" method calls asynchronous - and it worked!
...but only on my dev box running in debug mode.
When I pushed it up to the live site, it was faster, but it left some of the images unloaded, which is of course unacceptable.
So here is what I was hoping some SO hotshot would know:
1) Why are my asynchronous method calls working while debugging, but not working on the live site?
2) Is there any easier way to get a large number of sparklines of some sort to load quickly on a secure server without making me want to tear my hair out?
2a.) Does anyone have any experience using the ASP.NET Chart Library? Is this something I should investigate?
2b.) A co-worker suggested I make my own sparkline routine using a 1x1 CSS background image and varying the height. The problems are a) it is completely un-extensible in case we want to make changes; b) it seems hacky as hell (leaves about a bajillion DIVs per sparkline in the markup); and c) I have no idea if it will be fast enough when there are 100-200 of them on one page - what are your thoughts on the feasibility of the 1x1 sprite approach?
If I use jQuery AJAX to call a specific ASP.NET page method how to have that method return a value back to the AJAX method that called it?
Update
My situation is I have an existing web application with many existing methods. I would like to be able to use jQuery to execute some of these methods and then update the UI with the results. My mandate is to stay away from ASP.NET AJAX and stick with jQuery. Management is concerned about continued development and support with ASP.NET AJAX from Microsoft. I agree with them.
I am developing web application and in application i need to make call of jQuery using .ajax(); method with datatype is set jsonp. Now all works well with limited data but problem start to occur when data size is increasing......
View 7 RepliesI am using multiple user control in my web page. Each of these usercontrol has $(document).ready() method. Because i am using an update panel, i am binding all the events again in end_request event. But I dont want to do that in all my usercontrols. Is is possible to do this at a common place(only once)?
View 1 RepliesIn my Application i write one javascript function as
Page.ClientScript.RegisterStartupScript(typeof(Page), "myscript", "<script >document.execCommand('SaveAs');</script>");
to save that file.
its working fine in IE but in firefox mozila that save as window is not comming.
which function will work for both IE and FireFox mozila.
i have two data tables with the same structure
the first one has one row of the second one
the second one has set of rows
what i want is to get the row which comes next to the row of the first data table in the second data table.
the first data table his name is :: temp
the second data table his name is :: dt
i do the following:
DataTable temp = new DataTable();
temp = dt.Clone();
DataColumn[] keyColumn = new DataColumn[1];
keyColumn[0] = temp.Columns["photoId"];
temp.PrimaryKey = keyColumn;
temp = (DataTable)(Session["currentImage"]);
DataRow[] drr = new DataRow[1];
index = dt.Rows.IndexOf(temp.Rows[0]);
but the index always comes with one value = -1
although the temp.rows[0] its contents changed all the time
when i write dt.Rows.IndexOf(dt.Rows[1]) for examble i get 1
but this is not what i want to do ,, what i want to do exactly is to get the datarow next to the datarow of the first dataTable in the second dataTable
I ve just added quartz.net dll to my bin and started my example... How to call a c# method using quartz.net based on time?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Quartz;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(SendMail())
Response.write("Mail Sent Successfully");
}
public bool SendMail()
{
try
{
MailMessage mail = new MailMessage();
mail.To = "test@[URL]";
mail.From = "sample@[URL]";
mail.Subject = "Hai Test Web Mail";
mail.BodyFormat = MailFormat.Html;
mail.Body = "Hai Test Web Service";
SmtpMail.SmtpServer = [URL];
mail.Fields.Clear();
mail.Fields.Add([URL], "1");
mail.Fields.Add([URL], "redwolf@[URL]);
mail.Fields.Add([URL], "************");
mail.Fields.Add([URL], "465");
mail.Fields.Add([URL], "true");
SmtpMail.Send(mail);
return (true);
}
catch (Exception err)
{
throw err;
}
}
}
Here i am just sending a mail on page load. How to call SendMail() once in a day at a given time (say 6.00 AM) using quartz.net. I dont know how to get started? Should i configure it in my global.asax file.
asp.net 3.5...
I changed a method from public static void LogError(Exception exception) to public static Guid LogError(Exception exception) and once deployed the app throws the error
Method not found: 'System.Guid DefaultTechnologies.Portal.BusinessLogic.Common.LogError(System.Exception)'.
When deployed I sent all non-third party *.dll to be dropped into the bin folder. Runs fine from my machine :) but fails like crap everywhere else.
I have a complex ASP.NET application and it's running since 2009.I need to monitor it's performance and determine which methods in which layers are time or resource consuming. Then I can optimize methods.
Right now, I'm using SQL Profiler to check the queries and I tune the database step by step. I want to do the same for other layers (UI, Service, and Repository).I've used Postsharp and Enterprise Library Policy Injection Application Block.
I've implemented some attributes and add them to some classes which get BeforeMethodEntry and AfterMethodEntry (AOP model) automatically. Therefore, I can get the execution time of each method. It also handles exception log and page view log.
But, I think there may be another implemented/standard solution to monitor the running application.
PS: I've implemented some other solution like implementing ExceptionHttpModule and PageViewHttpModule which don't need any Third Party libraries. It doesn't meet my requirements.
*In a simple words, I want to log and monitor layer's activities (specially mehod execution duration). *
i am using many jquery pluging in web page so website .aspx file is taking long timeany tools jquery load client side locally. so speed is high or it is any way to load jquery pluging in client on time and use every time ,every day
View 3 RepliesI would like to create a progress bar with real time updates on the different method calls that happen on a button click in asp.net 1.1. I have seen some examples but nothing that provides updates on the progress bar while the server side operation executes.
View 1 RepliesLet's say we are building some public service that grabs the setup of a user (what server, user and pwd he wants to perform the call), logs in into that server and do some processing...
the process takes about 15 seconds to complete each user has a different setup (server/user/pwd), so the process needs to run against each one
if 1000 users tells the system to run the method at 1:00PM
How can I insure that the method is processed in the next 15 minutes?
What should be the correct approach to this little problem?
I'm thinking that I need to do something Asynchronously, and parallel processing could speed up things, maybe throttling the processes, maybe execute 100 calls per each 30 seconds?
I never did something like this and would love to get your feedback on ideas and future problems just to spend 100 hours of work and realize that I took a wrong road
I have as asp.net website the code behind is C#.
i my application Page load method is firing two time.
I want to use a function in the code file of ASP.NET such that everytime the function is called, its value increases by 1.I thought of a way but it didn't fully work out. I created a class for this and used a static variable in that but the lifetime of static variable in asp.net is till the time the app does not close.
public class Class1
{
public Class1()[code]....
How code a time delay before the next method is called? I have the following but I don't think it's waiting 10 seconds before calling CallMethod(). Thread.Sleep(10000); CallMethod();
View 2 RepliesI have Website Application , in which i have method ..i want to execute this after every 10 days automaticlally ..what is the concept of doing this , provice some code etc. if possible ..
my method includes some server side processing..
I am trying to create an ASP.NET MVC application, using Spring.NET to inject dependencies. The application has three tiers: Controller, Service, and Data. I have defined the objects in the file "~Resourcesobjects.xml". My first object, UserAccountController, requires the injection of two Service-tier classes: UserAccountService and DepartmentService. So, the definition in objects.xml looks like this:
<object id="UserAccountController" type="App.Controllers.UserAccountController, App">
<constructor-arg index="0" ref="DepartmentService" />
<constructor-arg index="1" ref="UserAccountService" /> </object>
<object id="UserAccountService" type="App.Service.UserAccountService, App">
<property name="UserAccountDao" ref="UserAccountDao" /> </object>
<object id="UserAccountDao" type="App.Data.UserAccountDao, App" />
<object id="DepartmentService" type="App.Service.DepartmentService, App">
<property name="DepartmentDao" ref="DepartmentDao" /> </object>
<object id="DepartmentDao" type="App.Data.DepartmentDao" />
Webconfig contains this:
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.WebContextHandler, Spring.Web"/>
</sectionGroup> </configSections> <spring> <context>
<resource uri="~/Resources/objects.xml" /> </context> </spring>
I would prefer to use Property injection rather than constructor, but currently neither method is working.
I am building a web application in asp.Net 4.0 and entity framework. I am trying to retrieve a list of products based on a collection of id's. I first gather all the id's in a collection and then pass it to the linq query. I am trying to get a functionality similar to the IN clause in SQL. The problem seems to be with the Contains() method in the Linq to entities query. Here is my Linq code:
[Code]....
I got the above Linq to entities method from here: [URL]
I have the following Extension Method
Imports System.Runtime.CompilerServices
Namespace Extensions
Public Module IntegerExtensions
<Extension()>
Public Function ToCommaDeliminatedNumber(ByVal int As Integer) As String
Dim _input As String = int.ToString
Select Case int
Case Is > 99999 : Return _input.Remove(_input.Length - 3) & "k"
Case Is > 9999 : Return Math.Round(Double.Parse(int / 1000), 1).ToString & "k"
Case Is > 999 : Return String.Format("{0:N0}", int)
Case Else : Return _input
End Select
End Function
End Module
End Namespace
And in one of my classes I'm using user.Reputation.ToCommaDeliminatedNumber I am importing the Extensions Namespace into the Class, but the error I'm getting is...'ToCommaDeliminatedNumber' is not a member of 'Integer?'. I do have other Extension Methods for Strings and Dates that work exactly as expected... I'm just at a loss on this one.
I'm very new to MVC so this is a simple issue, just can't seem to find any information on why it's happening so turning to the forums. Edit works, delete sort of works (that's another issue in itself), and details works, but create causes an issue. I've debugged the form being passed in and it's always null with default values. It's almost identical code to my edit so I'm not sure why edit works and create won't. I'd show code for the view but since it's working for edit I'm currently ruling that out as the problem. "Colleges" in this populates a dropdown in the view. Here's the code:
[Code]....
I have a web app where the user can create dynamic textboxes at run time. When the user clicks SUBMIT, the form sends data to the database and I want remove the dynamic controls.
The controls are created in the following code:
Table tb = new Table();
tb.ID = "tbl";
for (i = 0; i < myCount; i += 1)
{
TableRow tr = new TableRow();
TextBox txtEmplName = new TextBox();
TextBox txtEmplEmail = new TextBox();
TextBox txtEmplPhone = new TextBox();
TextBox txtEmplPosition = new TextBox();
TextBox txtEmplOfficeID = new TextBox();
txtEmplName.ID = "txtEmplName" + i.ToString();
txtEmplEmail.ID = "txtEmplEmail" + i.ToString();
txtEmplPhone.ID = "txtEmplPhone" + i.ToString();
txtEmplPosition.ID = "txtEmplPosition" + i.ToString();
txtEmplOfficeID.ID = "txtEmplOfficeID" + i.ToString();
tr.Cells.Add(tc);
tb.Rows.Add(tr);
}
Panel1.Controls.Add(tb);
The Remove section of the code is:
Table t = (Table)Page.FindControl("Panel1").FindControl("tbl");
foreach (TableRow tr in t.Rows)
{
for (i = 1; i < myCount; i += 1)
{
string txtEmplName = "txtEmplName" + i;
tr.Controls.Remove(t.FindControl(txtEmplName));
string txtEmplEmail = "txtEmplEmail" + i;
tr.Controls.Remove(t.FindControl(txtEmplEmail));
string txtEmplPhone = "txtEmplPhone" + i;
tr.Controls.Remove(t.FindControl(txtEmplPhone));
string txtEmplPosition = "txtEmplPosition" + i;
tr.Controls.Remove(t.FindControl(txtEmplPosition));
string txtEmplOfficeID = "txtEmplOfficeID" + i;
tr.Controls.Remove(t.FindControl(txtEmplOfficeID));
}
}
However, the textboxes are still visible.
I am new to jQuery, i am tring that In my pages contain four checkboxes then if any checkbox is checked then one div is dispaly , in that div some controls is placed. My intension is if checkbox is checked then validation for that particular div contained controls,
View 4 Replies