|
I doubt having the file under App_Code would make any difference.
Here's the entire file I'm using to test. I have a different master page, a different file name, and I'm not using a code-behind, but otherwise everything should be the same:
<%@ Page Language="C#"
MasterPageFile="~/_controls/Site.master"
Title="Chart Test"
%>
<%@ Import Namespace="System.Web.Services" %>
<script runat="server">
public class Data
{
public string ColumnName;
public double Value;
public string Date;
public Data(string name, double price, string date)
{
ColumnName = name;
Value = price;
Date = date;
}
}
[WebMethod]
public static List<Data> GetData(string name)
{
var dataList = new List<Data>();
dataList.Add(new Data("CLAVS 2007-1 M2A", 77, "Oct"));
dataList.Add(new Data("CLAVS 2007-1 M2A", 0, "Oct"));
dataList.Add(new Data("CLAVS 2007-1 M2A", 78, "Oct"));
dataList.Add(new Data("CLAVS 2007-1 M2A", 82, "Oct"));
dataList.Add(new Data("CLAVS 2007-1 M2A", 425, "Oct"));
dataList.Add(new Data("CLAVS 2007-1 M2A", 79, "Oct"));
dataList.Add(new Data("CLAVS 2007-1 M2A", 80, "Oct"));
dataList.Add(new Data("CLAVS 2007-1 M2A", 57, "Oct"));
dataList.Add(new Data("CLAVS 2007-1 M2A", 77, "Oct"));
dataList.Add(new Data("ACCDO 11A B", 2, "Sept"));
dataList.Add(new Data("ACCDO 11A B", 2, "Sept"));
dataList.Add(new Data("AELIS 2013-IRAR C", 96.89, "Sept"));
dataList.Add(new Data("AELIS 2013-IRAR C", 95, "Sept"));
dataList.Add(new Data("AELIS 2013-IRAR C", 95, "Sept"));
dataList.Add(new Data("AELIS 2013-IRAR C", 96, "Oct"));
dataList.Add(new Data("AELIS 2013-IRAR C", 97, "Sept"));
dataList.Add(new Data("AELIS 2013-IRAR C", 95, "Oct"));
dataList.Add(new Data("AELIS 2013-IRAR C", 85, "Sept"));
return dataList.FindAll(r => r.ColumnName.IndexOf(name, StringComparison.CurrentCultureIgnoreCase) != -1);
}
</script>
<asp:content runat="server" contentPlaceHolderID="bodyContentPlaceholder">
<form runat="server">
<asp:Label ID="Label1" runat="server" Text="Name/Ids"/>
<asp:TextBox ID="SearchText" runat="server" ClientIDMode="Static"/>
<asp:Button ID="Button1" runat="server" Text="Search" ClientIDMode="Static" />
<div id="visualization" style="width: 600px; height: 400px;" runat="server" ClientIDMode="Static"></div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="//www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', { packages: ['corechart'] });
</script>
<script type="text/javascript">
$('#Button1').click(function () {
$.ajax({
type: 'POST',
dataType: 'json',
contentType: 'application/json',
url: 'chart.aspx/GetData',
data: "{name:'" + $("#SearchText").val() + "'}",
success:
function (response) {
drawVisualization(response.d);
}
});
return false;
});
function drawVisualization(dataValues) {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Column Date');
data.addColumn('number', 'Column Value');
for (var i = 0; i < dataValues.length; i++) {
data.addRow([dataValues[i].Date, dataValues[i].Value]);
}
new google.visualization.LineChart(document.getElementById('visualization')).
draw(data, { title: "" });
}
</script>
</form>
</asp:content>
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Dear Richard,
Apology for the late response. I am writing to sincerely thank you for helping me on this small task. I really appreciate your support and time into this post. After long struggle, I manage to find the cause of problem which was syntax errors in the #button.click javascript code.
$(document).ready(function () {
$('#Button2').click(function () {
$.ajax({
type: 'POST',
dataType: 'json',
contentType: 'application/json',
url: 'Default.aspx/GetData',
data: "{name:'" + $("#SearchText").val() + "'}",
success:
function (response) {
drawVisualization(response.d);
}
});
return false;
});
});
Thanks a million for help. Have a great day.
Kind regards
|
|
|
|
|
Hey all,
I have got a problem with my buttons on my website, the buttons not always causing a postback, sometimes it works and sometime it does not, the buttons CausesValidation are set to false. I am not getting any javascript or server side errors.
Any Idea that will cause this issue?
modified 4-Nov-13 11:04am.
|
|
|
|
|
If you have CausesValidation set to True and you are not getting a postback, then it's possible that your validation controls are firing and not being displayed.
If you have validation controls set up make sure they are displayed properly to a ValidationSummary control. You could also set your CausesValidation property to False to by pass the validation and make sure it's hitting the server.
|
|
|
|
|
hey,
sorry, I meant to say my CauseValidation is set to false, I have take a look and there is no validation on that page.
|
|
|
|
|
Posting your code would help. Have you walked through it to make sure the code is following the proper path?
|
|
|
|
|
Hey Joshua,
I have solved the issue, it was my ComponentArt menu on my master page, I have read that it's a common issue with ComponentArt 2007 and framework 3.5, I decided to scrap the component and create my menu from scratch.
Thanks for your help
|
|
|
|
|
I am trying to change the password of users in Active Directory. My code is given below
------------------------------------------------------------------
DirectoryEntry entry = null;
entry = new DirectoryEntry("LDAP://10.8.128.101:389", "KSUSH\\" + username, password, AuthenticationTypes.Secure);
entry.UsePropertyCache = true;
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(&(objectClass=user)(sAMAccountName=Temp7))";
DirectoryEntry entryUser = search.FindOne().GetDirectoryEntry();
entryUser.Invoke("ChangePassword", Old_Password, New_Password);
entry.CommitChanges();
----------------------------------------------------------------
When it execute the entryUser.Invoke line. it gives me the error given below
Configuration information could not be read from the domain controller, either because the machine is unavailable, or access has been denied. (Exception from HRESULT: 0x80070547)
Please advice
tiyyob
|
|
|
|
|
hOW TO CREATE pc-phone,mobile dialer IN .NET PLATFORM
|
|
|
|
|
|
Can anybody tell me the Use of Delegate with real life example (program)?
You can e-mail me on theprofessional1992@gmail.com
|
|
|
|
|
|
By publishing your email address here, you invite spammers to contact you. That's not professional, is it?
|
|
|
|
|
I am new to MVC4. I am trying to issue ajax call on the button click to receive partial view with the loaded dropdown list. It looks like Ajax call never reaches controller's method GetMyList(). What is wrong with my code ? Thank you
//in mypage.cshtml
@model IEnumerable<MyProject.Models.MyModel>
@{
ViewBag.Title = "MyPage";
Layout = "~/Views/Shared/_MyLayout.cshtml";
}
<div>
....
<div>
<button id="btnGetList">Find</button>
</div>
<div id="divWithPartialView">
@Html.Partial("_MyPartialView", Model) // displayed on initial page load
</div>
...
</div>
@section MySection{
<script type="text/javascript">
$('#btnGetList').on('click', function (event) {
alert("go get list"); // shows up
var myName = "Jo";
$.ajax({
type: "POST",
url: "Main/GetMyList",
data: myName,
success: function (data) {
alert("list is here"); //does Not show up
$("#divWithPartialView").html(data);
}
});
alert("after ajax"); //shows up
})
</script>
}
// Controller
namespace MyProject.Controllers
{
public class MainController: Controller
{
............
[HttpGet]
public ActionResult MyPage()
{
List<MyModel> myList = new List<MyModel>();
return View(myList);
}
public ActionResult GetMyList(string myName)
{
MyModel mm = new MyModel();
List<MyModel> myList = mm.GetNames(myName); // using search criteria entered on the previous Application page
return PartialView("_MyPartialView", myList);
}
}
}
//Partial View: _MyPartialView.cshtml
@model IEnumerable<MyProject.Models.MyModel>
<label>Select your name:</label>
<select id="lstNames">
<option value="0">- select name -</option>
@foreach (var name in Model)
{
<option value="@name.id">@name.myName</option>
}
</select>
//Model
public class MyModel
{
public int id { get; private set; }
public string myName { get; set; }
public List<MyModel> GetNames(string myName)
{
List<MyModel> myList = new List<MyModel>();
//code to find names that start with "Jo"
return myList;
}
}
|
|
|
|
|
|
Try...
$.ajax({
...
...
url: '@Url.Action("ActionName","ControllerName")',
...
...
})
Pratik Bhuva
---------------
The night is darkest just before the dawn. And I promise you, the dawn is coming
|
|
|
|
|
Hi,
I am getting problem in rebind radgrid on radwindow close because i have to rebind 3 grid on parent page. It is rebinding just last grid which i have mentioned in code.
Following code i have used in my code
///------ In radwindow javascript code -------
function clientClose(arg) {
getRadWindow().close(arg);
var oWin = getRadWindow();
var parentWindow = oWin.BrowserWindow;
// top.location.href = top.location.href;
parentWindow.refreshGrid();
}
/// ---------In parent page javascirpt code -----
function refreshGrid() {
var masterTable1 = $find("<%=rgDefinition.ClientID%>").get_masterTableView();
var masterTable2 = $find("<%=rgDevelopment.ClientID%>").get_masterTableView();
var masterTable3 = $find("<%=rgTesting.ClientID%>").get_masterTableView();
masterTable1.rebind();
masterTable2.rebind();
masterTable3.rebind();
}
Problem is that ---- this code rebinding my last grid means masterTable3.rebind(); because it is in the last of code.
|
|
|
|
|
|
Hi,
I tried to return a variable value from SP. Pl help on this.
|
|
|
|
|
Help with what? Please edit your question and put some proper detail in it.
Veni, vidi, abiit domum
|
|
|
|
|
|
Have you ever used iron speed designer? What do you think of it? Any good or bad experience?
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Shopping
{
public class Cart
{
private int _IDproduct;
private string _nameProduct;
private int _Quantity;
private string _ImageUrl;
private double _Price;
private double _Total;
public Cart(){}
public Cart(int IDProduct, string NameProduct, int Quantity, string ImageURL, double Price){
_IDproduct = IDProduct;
_nameProduct = NameProduct;
_Quantity = Quantity;
_ImageUrl = ImageURL; ;
_Price = Price;
_Total = Price*Quantity;
}
public int IDProduct {
get { return _IDproduct; }
set { _IDproduct = value; }
}
public string NameProduct
{
get { return _nameProduct; }
set { _nameProduct = value; }
}
public int Quantity
{
get { return _Quantity; }
set { _Quantity = value; }
}
public string ImageURL
{
get { return _ImageUrl; }
set { _ImageUrl = value; }
}
public double Price
{
get { return _Price; }
set { _Price = value; }
}
public double Total
{
get { return _Price*_Quantity; }
}
}
public class CartItem{
private DateTime _dateCreate;
private DateTime _dateUpdate;
private List<Cart> _Item;
public CartItem() {
if(this._Item==null){
this._Item = new List<Cart>();
this._dateCreate = DateTime.Now;
}
}
public List<Cart> Item {
get { return _Item; }
set { _Item = value; }
}
public void Insert(int IDProduct, int Quantity, string ImageURL, string NameProuct, double Price) {
}
}
}
|
|
|
|
|
I'm not sure what your question exactly is.
if(this._Item==null)
This statement checks to see if the list has anything in it. If it doesn't then it will create a new list so you can store Cart objects in it
|
|
|
|
|
It is the constructor code for a CartItem object, although the if clause would seem redundant, as those two items would (presumably) always need to be set in the constructor. I'm not quite sure why a CartItem would hold a List of Cart objects, but no doubt there is a good reason.
Veni, vidi, abiit domum
|
|
|
|
|