0
網格視圖鏈接按鈕(其中一列)onclick不會觸發。真的不明白是什麼做錯了。需要幫忙。菜鳥編碼。網格視圖鏈接按鈕不點擊點擊asp.net?
的.aspx
<asp:GridView ID="gridTSRJOBList" runat="server" AutoGenerateColumns="False" CssClass="table table-striped table-bordered dataTable print-first-column-hide" CellSpacing="0" Width="100%" ShowHeaderWhenEmpty="True" EmptyDataText="No TSR JOB Found for this Lease" GridLines="None" DataKeyNames="JobID"role="grid">
<Columns>
<asp:TemplateField HeaderText="Job" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:LinkButton runat="server" ID="lnkJobID" CommandArgument='<%# Eval("JobID") %>' Text='<%#Eval("JobID") %>' OnClick="lnkJobID_Click"></asp:LinkButton></ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="CategoryID" HeaderText="Category" ReadOnly="True" />
<asp:BoundField DataField="JobDetail" HeaderText="Short Description" ReadOnly="True" />
<asp:BoundField DataField="JobType" HeaderText="Job Status" ReadOnly="True" />
<asp:BoundField DataField="CustomerReference" HeaderText=" Customer Reference" ReadOnly="True" />
</Columns>
</asp:GridView>
C#代碼
protected void lnkJobID_Click(object sender, EventArgs e)
{
try {
LinkButton jobLinkbutton = new LinkButton();
jobLinkbutton = (LinkButton)sender;
Response.Redirect("TSR_proc.aspx?bl=1&JOBID=" + jobLinkbutton.CommandArgument);
} catch (Exception ex) {
}
}
你在頁面中使用updatepanel嗎? – Koderzzzz
@Koderzzzz no mate –
鏈接按鈕中的用戶causesvalidation =「false」 – Koderzzzz