_____________________________
| | |
| Pending Review | (Button) |
|________________|__________|
sample gridview row ^
如何在单击按钮时更新gridview
中的此特定行?因此,待处理的审核消息应显示当前时间和日期。
答案 0 :(得分:0)
<asp:GridView ID="gvProduct"
CssClass="table table-hover table-responsive"
runat="server"
PageSize="15"
AllowPaging="True"
AllowSorting="True"
AutoGenerateColumns="False"
OnPageIndexChanging="gvProduct_PageIndexChanging"
BackColor="White"
BorderColor="#CCCCCC"
BorderStyle="None"
BorderWidth="1px"
CellPadding="3"
ShowHeaderWhenEmpty="true"
EmptyDataText="Product Not Available">
<Columns>
<asp:BoundField DataField="ProductCode"
HeaderText="Product Code" />
<asp:BoundField DataField="ProductName"
HeaderText="Product Name" />
<asp:BoundField DataField="Description"
HeaderText="Description" />
<%-- <asp:BoundField DataField="Type" HeaderText="Type" />--%>
<asp:BoundField DataField="Price"
HeaderText="Price" />
<asp:BoundField DataField="qty"
HeaderText="Qty" />
<asp:BoundField DataField="IsActive"
HeaderText="Status" />
<asp:TemplateField>
<HeaderTemplate>Action</HeaderTemplate>
<ItemTemplate>
<asp:LinkButton ID="lnkEdit"
runat="server"
Font-Underline="false"
CssClass="fa fa-pencil"
OnClick="lnkEdit_Click"
CommandArgument='<%# Eval("ID") %>'></asp:LinkButton> |
<asp:LinkButton ID="lnkdelete"
runat="server"
Font-Underline="false"
CssClass="fa fa-times"
OnClick="lnkDelete_Click"
CommandArgument='<%# Eval("ID") %>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="White"
ForeColor="#000066" />
<HeaderStyle BackColor="#006699"
Font-Bold="True"
ForeColor="White" />
<PagerStyle BackColor="White"
ForeColor="#000066"
HorizontalAlign="Left" />
<RowStyle ForeColor="#000066" />
<SelectedRowStyle BackColor="#669999"
Font-Bold="True"
ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#007DBB" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#00547E" />
</asp:GridView>
所有你绑定网格视图的拳头
上面的代码复制在aspx文件中并使用链接按钮并生成链接按钮单击事件
protected void lnkEdit_Click(object sender, EventArgs e)
{
LinkButton link = (LinkButton)sender;
long id = Convert.ToInt32(link.CommandArgument);
//find id of data and write update logic
}
这是示例代码,我希望它可以帮助您
答案 1 :(得分:-1)