我有充满适配器的 GridView:
OracleDataAdapter adapter = new OracleDataAdapter();
DataTable tableD = new DataTable();
adapter.SelectCommand = oracleCom;
adapter.Fill(tableD);
tableResults.DataSource = tableD.AsDataView();
tableResults.DataBind();
tableResults - 它是一个 GridView。我添加了在 GridView 中更改数据的功能:
tableResults.AutoGenerateEditButton = true;
tableResults.RowEditing += new GridViewEditEventHandler(tableResults_RowEditing);
tableResults.RowUpdating += new GridViewUpdateEventHandler(tableResults_RowUpdating);
tableResults.RowCancelingEdit += new GridViewCancelEditEventHandler(tableResults_RowCancelingEdit);
现在,从这里:
当用户推送编辑链接时,他会看到:
如何在空字段中显示当前值?
这是加法:
<asp:GridView ID="tableResults" runat="server" DataMember="Table"
EnableModelValidation="True" CssClass = "GridViewStyle"
OnRowDeleting = "dataViewRowDeleting" AutoGenerateDeleteButton="True">
<HeaderStyle CssClass = "GridViewHeaderStyle" />
<RowStyle CssClass = "GridViewRowStyle"/>
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:HyperLink runat="server" Text="Скачать объект" NavigateUrl='<%#"objects/" + Eval("Идентификатор") %>'></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>