当我使用这段代码时,它不想工作.
$('[id$=ADRESTextBox]').text(data[0]);
Run Code Online (Sandbox Code Playgroud)
您可以看到数据是一个数组.它确实有一个值(因为我提醒它)你如何用jQuery填充某个文本框.
我有一个下拉列表,填充国家(来自xml文件).
选择国家/地区时,可以使用文本框的自动填充功能.此自动填充包含来自所选国家/地区的邮政编码.
现在我想在dropdownlist.change事件之后立即设置自动完成功能,以防止1个国家/地区的自动填充(填写邮政编码)也适用于其他国家/地区.但你怎么把它关掉?
码:
//when changing country, other postcodes will load
$('[id$=landenDropDown]').change(function () {
//autocompletes removal
...
$('[id$=POSTCODETextBox]').html("");
var LandCode = $('[id$=landenDropDown]').attr("value");
//autocomplete with postal codes for Belgium
if (LandCode == "BE") {
//autocomplete postcode from selected country
$('[id$=POSTCODETextBox]').autocomplete("PostcodeBE.aspx");
}
//autocomplete with postal codes for Holland
else if (LandCode == "NL") {
//autocomplete postcode from selected country
$('[id$=POSTCODETextBox]').autocomplete("thingXml.aspx");
}
else {
//test
getal += 1;
alert(getal);
}
Run Code Online (Sandbox Code Playgroud)
问题是当自动完成功能完成并选择其他国家/地区时,此自动填充功能仍然存在,即使它不必显示也是如此.
在我的GetBusiness.aspx页面上,我创建了一个测试列表
List<string> l = new List<string>();
l.Add("one");
l.Add("two");
l.Add("three");
l.Add("four");
l.Add("five");
// B.
string[] s = l.ToArray();
Response.Write(s);
Run Code Online (Sandbox Code Playgroud)
在我的第二页上没有(默认的aspx页面)我有一些jQuery来加载这个数组并显示结果:
$.get('GetBusiness.aspx', function (returndata) {
// for each address in returndata
alert(returndata);
Run Code Online (Sandbox Code Playgroud)
但结果是:System.String []如果我迭代,他迭代字符串"System.String []"
$.each(returndata, function (index, value) {
alert(index + ': ' + value);
};
Run Code Online (Sandbox Code Playgroud)
如何显示字符串数组的结果?
对于我的管理应用程序,我在我的modelfolder中有一个包含实体的dbml文件(例如person,company,address,contact,...)
在mvc的帮助下,我可以处理到目前为止的所有CRUD操作,但只能处理1个实体.现在我想在人物实体的1个视图信息中显示联系人和地址实体的相应信息.实体已经与正确的关系连接.
我怎样才能有效地做到这一点?