[英]How to add buttons dynamically at the bottom of an asp.net gridview row
[英]How to add only row in gridView dynamically in asp.net?
我通過編寫以下代碼在asp.net中創建了gridView。
<asp:GridView ID="dataGrdVwPatientDetails" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:BoundField HeaderText="Patient" />
<asp:BoundField HeaderText="Modality" />
<asp:BoundField HeaderText="Test" />
<asp:BoundField HeaderText="Time" />
<asp:BoundField HeaderText="Referring Physician" />
<asp:BoundField HeaderText="TotalRs" />
<asp:BoundField HeaderText="Concession" />
<asp:BoundField HeaderText="Paid" />
<asp:BoundField HeaderText="Pending" />
</Columns>
</asp:GridView>
現在,我想在此gridView中添加空白行,以便將來可以在該單元格中添加值。
如下更改網格視圖:
<asp:GridView ID="dataGrdVwPatientDetails" DataKeyNames="ID" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="Patient" HeaderText="Patient" />
<asp:BoundField DataField="Modality" HeaderText="Modality" />
<asp:BoundField DataField="Test" HeaderText="Test" />
<asp:BoundField DataField="Time" HeaderText="Time" />
<asp:BoundField DataField="Referring_Physician" HeaderText="Referring Physician" />
<asp:BoundField DataField="TotalRs" HeaderText="TotalRs" />
<asp:BoundField DataField="Concession" HeaderText="Concession" />
<asp:BoundField DataField="Paid" HeaderText="Paid" />
<asp:BoundField DataField="Pending" HeaderText="Pending" />
</Columns>
然后您的sql查詢應如下所示:
select ID, patient, modality, test, time, Referring_Physician, TotalRs,
consession, paid, pending
from my_table
union all
select (max(ID) + 1) as ID, '' as patient, '' as modality, '' as test,
'' as time, '' as Referring_Physician, '' as TotalRs, '' as consession,
'' as paid, '' as pending
當用戶更新該字符串時,可以使用插入查詢。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.