我有一个名为“Path”的Gridview列,当用户点击它时,我希望它将“Path”单元格的值传递给子过程以执行以下代码,
process.start(Path)
目前该表是通过SQL查询填充的,“路径”是可点击的,但它想带我到URL,这对我的情况不起作用。我也尝试过Hyperlink列,但遇到了同样的问题。任何指导将不胜感激!提前谢谢。
答案 0 :(得分:1)
您可以使用LinkButton而不是HyperLink。
在LinkButton上设置CommandArgument,您可以使用GridView.RowCommand事件处理程序或LinkButton.OnClick事件处理程序来调用您的子。
Alamofire.upload(.POST, absPath(), headers: headers(), multipartFormData: { (multipartFormData:MultipartFormData) -> Void in
multipartFormData.appendBodyPart(data: json, name: "metadata", mimeType: "application/json")
multipartFormData.appendBodyPart(data: self.data, name: "document", fileName: "photo.png", mimeType: "image/png")
}, encodingMemoryThreshold: 10 * 1024 * 1024, encodingCompletion: { (encodingResult) -> Void in
switch encodingResult {
case .Success(let upload, _, _):
upload.responseJSON { response in
// success block
}
upload.progress { _, totalBytesRead, totalBytesExpectedToRead in
let progress = Float(totalBytesRead)/Float(totalBytesExpectedToRead)
// progress block
}
case .Failure(_):
// failure block
}
})
然后在代码背后:
<asp:GridView ID="gridView" runat="server" AutoGenerateColumns="False" OnRowCommand="gridView_RowCommand">
<Columns>
<asp:TemplateField HeaderText="Path">
<ItemTemplate>
<asp:LinkButton ID="lbPath" runat="server" CommandArgument="<%# Eval("Path")%>" OnClick="lbPath_Click"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
供参考
https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linkbutton(v=vs.110).aspx https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowcommand(v=vs.110).aspx