<asp:GridView ID ="FileGrid" runat="server" AutoGenerateColumns="False" OnRowCommand="FileGrid_RowCommand">
<Columns>
<asp:BoundField DataField="OriginalFileName" HeaderText="OriginalFileName" SortExpression="OriginalFileName" />
<asp:BoundField DataField="AttachmentGUID" HeaderText="AttachmentGUID" SortExpression="AttachmentGUID" />
<asp:ButtonField Text="Generate PDF" runat="server" HeaderText="Convert To PDF" CommandName="GeneratePDF_Click" />
</Columns>
</asp:GridView>
代码背后:
protected void FileGrid_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "GeneratePDF_Click")
{
int num = Convert.ToInt16(e.CommandArgument);
string attachmentGuid = FileGrid.Rows[num].Cells[1].Text;
Response.Redirect("DisplayImage.aspx?AttachmentGUID=" + attachmentGuid);
}
}
我看到很多使用OnClientClick
和asp:Button
的解决方案,但我无法在列中使用asp:Button
?
答案 0 :(得分:0)
您可以使用var url = "DisplayImage.aspx?AttachmentGUID=" + attachmentGuid;
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "popup", "window.open('" + url + "','_blank')", true);
打开一个新窗口:
var url = "DisplayImage.aspx?AttachmentGUID=" + attachmentGuid;
string redirect = "<script>window.open('" + url + "');</script>";
Response.Write(redirect);
或者您也可以尝试:
Public Function JanApr_prices()
Dim vArr As Variant
Dim lCount As Long
vArr = ThisWorkbook.Worksheets("catalogue").ListObjects(1).Range.Value2
For lCount = LBound(vArr) To UBound(vArr)
Select Case vArr(lCount, 1)
Case "Produkt A"
vArr(lCount, 2) = 4.8
Case "Produkt B"
vArr(lCount, 2) = 4.5
Case "Produkt C"
vArr(lCount, 2) = 6
Case "Produkt D"
vArr(lCount, 2) = 9
End Select
Next lCount
ThisWorkbook.Worksheets("catalogue").ListObjects(1).Range.Value2 = vArr
End Function