シンプルなものが欠けています。
GridView にバインドするバイナリ ファイルをいくつか生成しています。
FileDownloadGrid.DataSource = downloadList;
FileDownloadGrid.DataBind();
グリッドの興味深い部分は、次のようにコーディングされています。
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="DownloadFile" runat="server" Text="Download" CommandName="DownloadFile1"
CommandArgument='<%#Eval("FullName") +"|" + Eval("Name") %>'>
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
IFRAME Ajax メソッドを実行してファイルをダウンロードしようとしています。
function InitializeRequest(sender, args) {
// Check to be sure this async postback is actually
// requesting the file download.
if (sender._postBackSettings.sourceElement.id == "FileDownloadGrid") {
// Create an IFRAME.
var iframe = document.createElement("iframe");
// Get the desired region from the dropdown.
var fName = $get("CommandArgument").value;
// Point the IFRAME to GenerateFile, with the
// desired region as a querystring argument.
iframe.src = "Default2.aspx?fName=" + fName;
// This makes the IFRAME invisible to the user.
iframe.style.display = "none";
// Add the IFRAME to the page. This will trigger
// a request to GenerateFile now.
document.body.appendChild(iframe);
}
}
Web で見つけたものから、CommandArgument クライアント側を取得できず、スクリプトで「FullName」を取得する方法がわかりません。
誰かが私を正しい方向に向けることができますか? 私はかなりシンプルであるべき何かのために髪を引っ張っています。
ありがとう
遺伝子