本人需要用SpreadJS取代一個現用的GridView(見以下編程)。請問在report.ascx的SpreadJS可否像以下的gridview讀取report.ascx.cx的SQL數據?(在網上只找到SpreadJS要經過URL接到web service的例子)
請賜教要如何修改。
***** report.ascx *****
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="report.ascx.cs" Inherits="report" %>
Search:&nbsp;
<asp:TextBox ID="txtSearch" runat="server"></asp:TextBox>&nbsp;
<asp:Button ID="btnSearch" runat="server" Text="Button" OnClick="btnSearch_Click" /><br />
<br />
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
***** report.ascx.cx ******
public partial class report : DotNetNuke.Entities.Modules.PortalModuleBase
{
protected void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
{
ShowData("");
}
}
protected void btnSearch_Click(object sender, System.EventArgs e)
{
ShowData(txtSearch.Text);
}
private void ShowData(string SearchString)
{
string ConnectionStr = "Server=Server;Database=Db;uid=User;pwd=Password;";
StringBuilder mySqlString = new StringBuilder();
mySqlString.Append("SELECT * ");
mySqlString.Append("FROM dbo.Report_Invoiced_Order_Summary ");
mySqlString.Append("WHERE [Period] = '" + @SearchString + "'");
mySqlString.Append("ORDER BY [Country]");
SqlParameter myParam = new SqlParameter("@SearchString", SqlDbType.VarChar, 150);
myParam.Value = SearchString;
this.GridView1.DataSource = ((IDataReader)(SqlHelper.ExecuteReader(ConnectionStr, CommandType.Text, mySqlString.ToString(), myParam)));
this.GridView1.DataBind();
}
} |
|