|
Does the file jquery-1.10.2.min.js exist?
Why are you working with such an old version of jQuery anyway?
The current version is 3.something I think.
The latest minor version of version 1 is 12, so 1.10 is old even for jQuery 1 standards
|
|
|
|
|
Sander Rossel wrote: Does the file jquery-1.10.2.min.js exist?
Yes
Sander Rossel wrote: Why are you working with such an old version of jQuery anyway?
Because I don't know any better.
Sander Rossel wrote: The current version is 3.something I think.
Think it would make a difference here?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
I'm not sure whether you've messed up your formatting again or if that is your actual code, but you have an extra " in your jquery script tag.
Just noticed that now and it may be your problem.
|
|
|
|
|
Got it working!!
1) Doesn't work on IE.. Stumbled upon this by Googling another error message "Object doesn't support property or method 'indexOf'"
2) Updated jquery and signalr to latest
3) Fixed that format error. There was indeed an extra "
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
|
The path is wrong. You have /Scripts for signalR (which is clearly running since you get the error from it) but you have just Scripts (note the missing / ) for jquery. Hence, the jQuery file is not being loaded.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
What should it be? It's relative from where?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Kevin Marois wrote: It's relative from where? From where the code executes.
Kevin Marois wrote: What should it be? Since signalR.js is getting loaded then /Scripts must be correct.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Got it working!!
1) Doesn't work on IE.. Stumbled upon this by Googling another error message "Object doesn't support property or method 'indexOf'"
2) Updated jquery and signalr to latest
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
First, this is my first ever attempt ay writing JavaScript, so forgive my ignorance...
My app is listening to a SignalR service. When the server hub calls "NotifyAllClientsOfChanges" I want my WebGrid to be reloaded. I'm getting an exception.
1) The Controller code:
public class HomeController : Controller
{
private IDataAccess _dal;
private DashboardClientProxy _dashboardProxy;
public HomeController()
{
_dal = new DataAccess();
_dashboardProxy = new DashboardClientProxy();
try
{
_dashboardProxy.Connect();
}
catch (Exception e)
{
throw e;
}
}
public ActionResult Index()
{
var data = GetData();
return View(data);
}
public IEnumerable<AssayDashboardInfoEntity> GetData()
{
var data = _dal.GetDashboardInfos(new DashboardInfoQueryArgs());
return data;
}
}
2) Next my JS code.
<script language="javascript">
$(function () {
<pre>
proxy.client.NotifyAllClientsOfChanges = function () {
var searchUrl = "Home/GetData";
$.ajax({
url: searchUrl,
type: "POST",
success: function (data) {
$("#divData").html(data);
}
});
};
});</pre>
3) When I run it I get
var searchUrl = "Home/GetData";
$.ajax({
url: searchUrl,
type: "POST",
success: function (data) {
$("#divData").html(data);
$("#btnSearch").attr({ 'value': 'Search' });
}
});
Unhandled exception at line 59, column 5 in http:
0x800a1391 - JavaScript runtime error: '$' is undefined
Someone please help. What am I doing wrong???
Line 59 is the "$(function () {" line
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
modified 2-Mar-17 13:44pm.
|
|
|
|
|
The error says $ is not defined. $ is, typically, the jQuery function.
$(function () {...}); is jQuery's startup function (goes off when the entire page loaded), but it seems you never loaded jQuery.
So make sure to include jQuery in your scripts before any of your own code.
|
|
|
|
|
You're right. I didn't have
<!--Reference the jQuery library. -->
<script src="Scripts/jquery-1.6.4.min.js" "></script>
<!--Reference the SignalR library. -->
<script src="/Scripts/jquery.signalR-2.0.0.js"></script>
<!--Reference the autogenerated SignalR hub script. -->
<script src="/signalr/hubs"></script>
I put this just after the tag. And I moved my function right below all of that, so I now have:
<body>
<pre>
<!--Reference the jQuery library. -->
<script src="Scripts/jquery-1.6.4.min.js" "></script>
<!--Reference the SignalR library. -->
<script src="/Scripts/jquery.signalR-2.0.0.js"></script>
<!--Reference the autogenerated SignalR hub script. -->
<script src="/signalr/hubs"></script>
<script type="text/javascript">
$(function () {
proxy.client.NotifyAllClientsOfChanges = function () {
var searchUrl = "Home/GetData";
$.ajax({
url: searchUrl,
type: "POST",
success: function (data) {
$("#divData").html(data);
}
});
};
});
I then got this.
So I fixed the jquery version, so I now have:
<!--Reference the jQuery library. -->
<script src="Scripts/jquery-1.10.2.min.js" "></script>
<!--Reference the SignalR library. -->
<script src="/Scripts/jquery.signalR-2.2.1.js"></script>
Now I get
" jQuery was not found. Please ensure jQuery is referenced before the SignalR client JavaScript file."
The jquery script if referenced first. What else could be wrong?
[UPDATE]
Going to start a new question
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Is it on the top in the scripts hierarchy? It should be.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
hi all,
please help me to solve this .
i am using windows 7 for development with vs2010, have one application(wpf) which is running proper with click on .exe, but when i used to call same by some third-party application which is made by using win Xp- service pack -03, shows white stable popup which is not movable and appearance till application closed, other all functionalities of application runs smoothly only this popup appearance.
|
|
|
|
|
Member 12270195 wrote: call same by some third-party application You need to talk to the people who wrote that application.
|
|
|
|
|
Hello,
I have the following control that uses Localization.
I have defined ResPropName in the English resource file as EnglishProperty and in the Spanish Resource file as SpanishProperty. Both properties are defined in the mySource.
Issue: When I try to switch languages, the Content of the checkboxes appears as SpanishProperty or EnglishProperty.
If I would replace the listbox with a combobox the language would switch and the proper text appears.
I have done the same test on one single check-box and I got the same issue.
It seems that the Content property of the Checkbox is not resolving the property while the DisplayMemberPath of the Combobox does.
Come on Guys. I really need help with this one.
<UserControl x:Class="WpfApplication2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:local="clr-namespace:WpfApplication2"
LocalizationScope.ResourceManager="{ResourceManager AssemblyName=WpfApplication2, BaseName=WpfApplication2.Resources.WpfApplication2Resources}"
mc:Ignorable="d" Height="350" Width="525">
<Grid>
<ListBox Name="listBox" ItemsSource="{Binding mySource}">
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox Name="CheckBox" Content="{Loc ResPropName}">
</CheckBox>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</UserControl>
<ComboBox ItemsSource="{Binding mySource}" DisplayMemberPath="{Loc ResPropName}" />
modified 15-Feb-17 12:33pm.
|
|
|
|
|
Hi,
I included DialogService in my Window to call other view which contains User input values
What I need is to prevent closing this dialog until input are validated.
_roleViewModel = new Role_ViewModel(eTypeOperation);
var createCommand = new UICommand
{
Id = MessageBoxResult.OK,
Caption = Properties.Resources.CstOk,
IsCancel = false,
IsDefault = true,
Command = new DelegateCommand(CreateRole, CanCreateRole)
};
var cancelCommand = new UICommand
{
Id = MessageBoxResult.Cancel,
Caption = Properties.Resources.CstCancel,
IsCancel = true,
IsDefault = false,
};
RoleService.ShowDialog(new List<UICommand> { createCommand, cancelCommand }, Properties.Resources.CstNewRole, _roleViewModel);
private IDialogService RoleService
{
get { return GetService<IDialogService>("RoleServiceDialog"); }
}
the CanCreateRole control the state of Button "OK" regarding input user But What I need is to :
When click OK button , we should check data (user input) if it is ok we return and close the DialogService otherwise we should display messagebox and stay on this DialogService (don't close) until press "Cancel"
Thank you
|
|
|
|
|
In your CanCreateRole method, validate the input, and return false if the input is not valid.
In your CreateRole method, call CanCreateRole to validate the input, and if it's not valid, don't close the dialog.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
But this did'nt solve my problem
because what I need is :
- let user enter some data (if no data => the button still disabled related to
CanCreateRole - when there is data click on Button "OK"
- if the data are valid against condition we do nothing and the DialogService close (normal behavior)
ELSE (data not valid ) we display messagebox and the DialogService is still shown with last data entered.
|
|
|
|
|
So do your extra validation in the CreateRole method, and don't close the dialog if it fails.
Or are you saying that the dialog always closes after invoking the command? If that's the case, we'll need to know what the implementation of your dialog service looks like.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
the code of command is as described in the first question :
var createCommand = new UICommand
{
Id = MessageBoxResult.OK,
Caption = Properties.Resources.CstOk,
IsCancel = false,
IsDefault = true,
Command = new DelegateCommand(CreateRole, CanCreateRole)
};
|
|
|
|
|
Yes, but we can't see your dialog service code.
If it's something you've written, then you need to show the relevant parts of the code.
If it's something you got from an article or GitHub project, then we'll need a link to the source.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
In my MainWindow.xaml (which will validate data after click on OK )
<pre> <dxmvvm:Interaction.Behaviors>
<dx:DXMessageBoxService />
<dxmvvm:CurrentWindowService Window="{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}, Mode=FindAncestor}}" />
<dx:DialogService DialogWindowStartupLocation="CenterOwner" Name="RoleServiceDialog">
<dx:DialogService.ViewTemplate>
<DataTemplate>
<views:Role_View></views:Role_View>
</DataTemplate>
</dx:DialogService.ViewTemplate>
</dx:DialogService>
</dxmvvm:Interaction.Behaviors>
in MainWindow.cs (the ViewModel related to the MainWindow.xaml)
_roleViewModel = new Role_ViewModel(eTypeOperation);
var createCommand = new UICommand
{
Id = MessageBoxResult.OK,
Caption = Properties.Resources.CstOk,
IsCancel = false,
IsDefault = true,
Command = new DelegateCommand(CreateRole, CanCreateRole)
};
var cancelCommand = new UICommand
{
Id = MessageBoxResult.Cancel,
Caption = Properties.Resources.CstCancel,
IsCancel = true,
IsDefault = false,
};
RoleService.ShowDialog(new List<UICommand> { createCommand, cancelCommand},Properties.Resources.CstNewRole, _roleViewModel);
private void CreateRole()
{
_roleViewModel.AcceptChanges();
if (ValidateData(_roleViewModel.RoleName.Trim()))
{
AddRole(_roleViewModel.RoleName, _roleViewModel.RoleDescription);
}
}
private bool CanCreateRole()
{
return !string.IsNullOrEmpty(_roleViewModel.RoleName.Trim());
}
|
|
|
|
|
So you're using the DevExpress MVVM framework?
Looking at the documentation[^], your command can take a CancelEventArgs parameter to allow it to keep the dialog open:
Note that dialog commands take a CancelEventArgs object as a parameter. When dialog commands are invoked, the dialog is closed by default. To prevent this behavior, it is necessary to set the CancelEventArgs.Cancel parameter to True.
var createCommand = new UICommand
{
Id = MessageBoxResult.OK,
Caption = Properties.Resources.CstOk,
IsCancel = false,
IsDefault = true,
Command = new DelegateCommand<CancelEventArgs>(CreateRole, CanCreateRole)
};
private bool CanCreateRole(CancelEventArgs e)
{
return !string.IsNullOrWhiteSpace(_roleViewModel.RoleName);
}
private void CreateRole(CancelEventArgs e)
{
_roleViewModel.AcceptChanges();
if (ValidateData(_roleViewModel.RoleName.Trim()))
{
AddRole(_roleViewModel.RoleName, _roleViewModel.RoleDescription);
}
else
{
e.Cancel = true;
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|