我的jQuery自动完成字段有问题.它有些奇怪.
这是我的自动填充字段和脚本.我的mvc函数的响应运行正常.下拉列表是可见条目.但是当我试图选择一个项目时,结果列表就会消失.有没有人有想法?
<div class="ui-widget">
<input id="newPlayerName" type="text" name="newPlayerName" onkeyup="checkRegistration()" />
</div>
Run Code Online (Sandbox Code Playgroud)
码:
<script type="text/javascript">
$(function () {
$('#newPlayerName').autocomplete({
source: function (request, response) {
$.ajax({
url: '/Trainer/Search',
data: {
searchTerm: request.term
},
dataType: 'json',
type: 'POST',
minLength: 1,
success: function (data) {
response(data);
}
});
},
select: function (event, ui) {
checkRegistration(ui.item.value);
},
focus: function (event, ui) {
event.preventDefault();
$("#newPlayerName").val(ui.item.label);
}
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
啊......这是我正在使用的jquery脚本......
<script src="/Scripts/jquery-1.9.0.js" type="text/javascript"></script>
<script src="/Scripts/jquery-ui-1.10.0.custom.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery-ui-1.10.0.custom.js" type="text/javascript"></script>
Run Code Online (Sandbox Code Playgroud) 解析String到目前为止我遇到了一些问题.我在stackoverflow上搜索了一个想法,我得到了我的答案,但它仍然没有工作..所以..
我试图解析一个看起来像这样的字符串
1985年1月8日00:00:00 CET
我正在尝试的是这个..
private Date getDateFromString(String sDate)
{
String dateFormat = "EEE MMM dd HH:mm:ss z yyyy";
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
sdf.setTimeZone(TimeZone.getTimeZone("CET"));
Date newDate = null;
try {
newDate = sdf.parse(sDate);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return newDate;
}
Run Code Online (Sandbox Code Playgroud)
当然有人可以帮助我:-)谢谢你的预测
我有一个小问题将图像绑定到Radiobuttion.我只想通过XAML绑定它,我所做的就是这个......我创建了一个带有5个radiobutton的Stackpanel.
<StackPanel Name="StackPanel1" Grid.Row="3" Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
<RadioButton GroupName="Group1" Content="1"
HorizontalAlignment="Left"
Width="35" BorderThickness="1,0,0,1"
IsChecked="CodeBehindBinding..." />
<RadioButton GroupName="Group1" Content="2"
HorizontalAlignment="Left" VerticalAlignment="Top"
Width="35" BorderThickness="1,0,0,1"
IsChecked="{CodeBehindBinding..." />
......
Run Code Online (Sandbox Code Playgroud)
在XAML的其他地方,我试图将Label绑定到组.一起..
<Image Grid.Row="3" Grid.Column="2" HorizontalAlignment="Left" Height="25" VerticalAlignment="Top" Width="25" Source="/*****;component/Resources/Checked.png"
Visibility="{Binding IsChecked, BindingGroupName=StackPanel1.Group1}"
/>
Run Code Online (Sandbox Code Playgroud)
...... Nothinig发生了.;-)图像是永久可见的.
我该如何解决?希望你能帮忙.. Greetz Iki
asp.net-mvc ×1
autocomplete ×1
binding ×1
date ×1
java ×1
jquery ×1
parsing ×1
string ×1
wpf ×1
xaml ×1