我不确定我的设计是否有缺陷,但想知道其他人有什么要说的,我正处于一种情况下,我试图一次点击两件事.
使用:asp.net web表单
我有一个网页表单,几乎没有文本框和gridview控件和一个按钮.
如果我点击按钮我正在执行两件事
1)异步从服务器到客户端获取数据(工作得很好)并能够在文本框中显示数据.
2)同样点击我想绑定gridview.
<asp:Content ID="Content2" ContentPlaceHolderID="cphMaster" runat="server">
<asp:Label runat="server" ID='Label1' >Id:</asp:Label>
<asp:TextBox ID="txtId" runat='server'></asp:TextBox>
<asp:Button ID="btnSubmit" OnClientClick="LoadDataById();" runat="server" Text="Submit"
onclick="btnSubmit_Click" />
<br />
<br />
<asp:TextBox ID="txtName" runat='server'></asp:TextBox> <br />
<asp:TextBox ID="txtPurpose" runat='server'></asp:TextBox> <br />
<br />
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</asp:Content>
Run Code Online (Sandbox Code Playgroud)
服务器端
protected void btnSubmit_Click(object sender, EventArgs e)
{
GridView1.DataSource = laodData(int.Parse(txtId.Text));
GridView1.DataBind();
}
Run Code Online (Sandbox Code Playgroud)
jQuery的:
function LoadVisitBasicByVisitId() {
ContactServiceProxy.invoke({ serviceMethod: "GetDataById",
data: { request: request },
callback: function(response) {
processCompletedContactStore(response);
},
error: function(xhr, errorMsg, thrown) …Run Code Online (Sandbox Code Playgroud) 是否可以将数据发布到JSONP?或者所有数据都必须作为GET请求在查询字符串中传递?任何示例代码.
谢谢
以下是我获取的数据:
jsonp1290537545248([{"Active":true,"EndDate":"\/Date(-62135578800000-0500)\ /","StartDate":"\/Date(1280635200000-0400)\ /"}]);
$.getJSON(url, {},
function (data) {
alert(data[0].EndDate);
alert(Date(data[0].StartDate));
//alert(data[0].StartDate.getDate());// + "/" + (data[0].StartDate.getMonth() + 1) + "/" + data[0].StartDate.getFullYear()); // alerts: "15/10/2008"
//var date = eval(jsonDate.replace(/\/Date\((\d+)\)\//gi, "new Date($1)"));
alert('dd ' + new Date(parseInt(data.substr(6))));
});
Run Code Online (Sandbox Code Playgroud)
我如何获得MM/DD/YYYY格式?
当我提醒它返回这样的字符串:
data "<?xml version="1.0" encoding="utf-8" ?>
<xml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Name>John Smith</Name>
<Description>stackoverflow</Description>
<Total>50</Total>
</Document>
</xml>"
Run Code Online (Sandbox Code Playgroud)
更新:
我尝试使用此方法getJSON,我确实收到警报但从未在内部执行find('Document').each.....
$.getJSON(_url, function (data) {
alert(data);
$(data).find('Document').each(function () {
debugger
var name = $(this).find('Name');
var desc = $(this).find('Description').text();
var total = $(this).find('Total').text()
});
});
Run Code Online (Sandbox Code Playgroud)
如何在jquery中读取xml文件,下面是将我作为字符串返回的内容,我可以看到当我做警报(数据)时;
$.getJSON(url, {},
function (data) {
alert(data);
}
});
<?xml version="1.0" encoding="utf-8" ?>
- <xml xmlns="http://www.opengis.net/kml/2.2">
- <Document>
<Name>John Smith</Name>
<Description>stackoverflow</Description>
<Total>50</Total>
</Document>
</xml>
Run Code Online (Sandbox Code Playgroud) 什么是错的,为什么抱怨关闭")"?
<asp:TemplateField HeaderText="Name" SortExpression="Name">
<ItemTemplate>
<%# FixNull((namespace.Student)(Container.DataItem), "Name"); %>
</ItemTemplate>
<EditItemTemplate>
<asp:dropdownlist id="ddlStudent" runat="server" datasourceid="CountyDataSource"
datatextfield="Name" datavaluefield="Id" autopostback="false">
</asp:dropdownlist>
</EditItemTemplate>
</asp:TemplateField>
protected string FixNull(object dataItem, string fieldName)
{
if (dataItem != null)
{
System.Data.DataRowView cls = (System.Data.DataRowView)dataItem;
if (!cls.Row.IsNull(fieldName))
return (cls[fieldName]).ToString();
else
return " ";
}
else
return " ";
}
Compiler Error Message: CS1026: ) expected
Source Error: Line: 133
Line 131: <asp:TemplateField HeaderText="Name" SortExpression="Name">
Line 132: <ItemTemplate>
Line 133: <%# FixNull((namespace.Student)(Container.DataItem), "Name"); %>
Line 134: </ItemTemplate>
Line 135: …Run Code Online (Sandbox Code Playgroud) 我正在尝试实现Message API
我不确定我将如何从代码隐藏和它们的代码片段中调用它,它说:
https://platform.3cinteractive.com/api/send_message.php
POST
username=aRDSe3vcaMzh06YrMcxcQw==&password=1BSvQc6lpNlnp4ufWgRLPHNJ7RMrL8CcaWCzL1Vtw+Y=&phone_number=+11234567890&trigger_id=1105&message=howdy
Run Code Online (Sandbox Code Playgroud) System.Web.UI.HtmlControls.HtmlGenericControl div = (System.Web.UI.HtmlControls.HtmlGenericControl)pnl.Controls[0].FindControl("divMessage");
Run Code Online (Sandbox Code Playgroud)
我试图找到divMessage像上面这样的东西,但我得到了空...:
下面是我的div如何居住.
<mobile:Panel ID="pnl" Runat="server">
<mobile:DeviceSpecific ID="device" runat="server">
<ContentTemplate>
<div id="divMessage" runat="server">test.....</div>
</ContentTemplate>
</mobile:DeviceSpecific>
</mobile:Panel>
Run Code Online (Sandbox Code Playgroud) 在这里给我一个错误:
string.Compare(list[], list1[],true); <<<<<<
Run Code Online (Sandbox Code Playgroud)
导致错误.
string[] list = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "v", "z" };
string[] list1 = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "v", "z" };
int result = string.Compare(list[], list1[], true);
if (result == 0)
{
Label1.Text += …Run Code Online (Sandbox Code Playgroud) 我有两个项目1)类库,没有接口只是一个api 2)Web应用程序
从网络应用程序我将调用类库api
所以我在Web应用程序中拥有所有web.config设置,但是当我调试它总是返回我的null值,这里是代码snippit:
public static string readingDB
{
get
{
string result = null;
result = ConfigurationManager.AppSettings["employeeDB"]; //conn string
if (!string.IsNullOrEmpty(result))
{
return result;
}
else
{
return ""; //???? THROW EXCEPTION???
}
}
}
Run Code Online (Sandbox Code Playgroud)
我也试过,在类库项目中创建一个新的app.config,并在那里有相同的appsettings但不起作用...
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<applicationSettings>
<add name="employeeDB" connectionString="Data Source=servername;Initial Catalog=employee;Persist Security Info=True;User ID=userid;Password=password;"/>
</applicationSettings>
<customErrors mode="On"/>
</configuration>
Run Code Online (Sandbox Code Playgroud)
任何帮助?