aspx:
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
获得淘宝授权: <asp:LinkButton ID="LinkButton1" runat="server" PostBackUrl="LinkButtonhttp://open.taobao.com/isv/authorize.php?appkey=test">LinkButton</asp:LinkButton>
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /><div>
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</div>
</form>
.cs
protected void Button1_Click(object sender, EventArgs e)
{
string sessionKey = getSessionKey(TextBox1.Text);
if (sessionKey.StartsWith("Error"))
{
Response.Write("<script>alert(''获取SessionKey失败,请更换您的授权码'')</script>");>
return;
}
DataTable table = new DataTable();
DataColumn c1 = new DataColumn("订单编号", typeof(string));
table.Columns.Add(c1);
DataColumn c2 = new DataColumn("买家昵称", typeof(string));
table.Columns.Add(c2);
DataColumn c3 = new DataColumn("卖家昵称", typeof(string));
table.Columns.Add(c3);
DataColumn c4 = new DataColumn("订单状态", typeof(string));
table.Columns.Add(c4);
DataColumn c5 = new DataColumn("商品标题", typeof(string));
table.Columns.Add(c5);
DataColumn c6 = new DataColumn("价格", typeof(string));
table.Columns.Add(c6);
DataColumn c7 = new DataColumn("数量", typeof(string));
table.Columns.Add(c7);
|