You don't need to use live because the button is loaded with the page. Also you don't need to wrap the call jquery.live... with function. Does the alert function fire?
Are you using a JavaScript debugger? If so, are there any errors, if not open the page in chrome and press F12 to bring up the developer tools window.
Up vote 1 down vote favorite share g+ share fb share tw.
I want to load jqGrid on button click in MVC 3 but I am unable to do it. Data is coming fine but nothing is happening on the page. When I click, it shows grid loading but then after nothing happens.
Please see following: My View @{ ViewBag. Title = "Home"; } @section Javascript { } @using (Html. BeginForm("Home", "Home")) { @Html.
Label("lblCustomerID", "Customer ID") @Html. TextBoxFor(m => m.Customer. CustomerID, new { @style = "width: 100px" }) @Html.
Label("lblUserID", "User ID") @Html. TextBoxFor(m => m.Customer. UserID, new { @style = "width: 100px" }) @Html.
Label("lblPIC", "PIC") @Html. TextBoxFor(m => m.Customer. PIC, new { @style = "width: 100px" }) @Html.
Label("lblLastName", "Last Name") @Html. TextBoxFor(m => m.Customer. LastName, new { @style = "width: 100px" }) @Html.
Label("lblInvoiceNo", "Invoice No") @Html. TextBoxFor(m => m.FormTransaction. InvoiceNumber, new { @style = "width: 100px" }) @Html.
Label("lblEmail", "Email") @Html. TextBoxFor(m => m.Customer. Email, new { @style = "width: 100px" }) } MyController using System; using System.Collections.
Generic; using System. Linq; using System.Data. Linq; using System.Linq.
Expressions; using System. Web; using System.Web. Mvc; using System.
Dynamic; using System.Data.Objects. SqlClient; using NLISHelpdesk.WebUI. Models; using NLISHelpdesk.WebUI.
Entities; using NLISHelpdesk.WebUI. Repositories; namespace NLISHelpdesk.WebUI. Controllers { public class HomeController : Controller { // // GET: /Home/ public ActionResult Home() { CustomerViewModel ViewModel = new CustomerViewModel { Customer = new Customer(), FormTransaction = new FormTransaction(), Customers = new List() }; return View("Home", ViewModel); } HttpPost public JsonResult LoadCustomerData(string sidx, string sord, int page, int rows, bool _search, string searchField, string searchOper, string searchString) { NLISHELPDESKEntities _CustomerContext = new NLISHELPDESKEntities(); var query = (from cus in _CustomerContext.
Customers select new Cust { CustomerID = cus. CustomerID, FirstName = cus. FirstName, LastName = cus.
LastName } ).ToList(); Customers = query; // Calculate the total number of pages var totalRecords = query.Count(); var totalPages = (int)Math. Ceiling((double)totalRecords / (double)rows); // Prepare the data to fit the requirement of jQGrid var data = (from s in Customers select new { id = s. CustomerID, cell = new object { s.
CustomerID, s. FirstName, s. LastName} }).ToArray(); // Send the data to the jQGrid var jsonData = new { total = totalPages, page = page, records = totalRecords, rows = data.
Skip((page - 1) * rows). Take(rows) }; return Json(jsonData, JsonRequestBehavior. AllowGet); } } } Class public class Cust { public int CustomerID { get; set; } public string FirstName { get; set; } public string LastName { get; set; } } } please help.... c# jquery asp.net asp.net-mvc-3 link|improve this question edited Jan 19 at 3:02David Hoerster10.2k2829 asked Jan 19 at 1:14sensational61.
– clyc Jan 19 at 3:06 I'm assuming both of your alerts are firing. Is that correct? – David Hoerster Jan 19 at 3:10 yes thats just for testing... – sensational Jan 19 at 4:38.
I am not using live that was just for testing. Its the actual button click event. Now my problem is I don't want to bind when the page loads.
I want to bind the grid only on button click. I don't know how to achieve that... – sensational Jan 19 at 4:13 You should post the code that is causing trouble, not other random code – Jason Jan 19 at 4:15 You will see in the following code that I had to call bindCustomer() which bind the jqgrid. I don't want do that rather I want to bind the grid only on button click.
$(document). Ready ( function () { bindCustomers(); $('#btnContinue'). Live('click', function () { $('#jqTable').
Trigger("reloadGrid"); }); } ); – sensational Jan 19 at 4:31.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.