从 GridView 上的选择填充 FormView

发布于 2024-12-22 11:03:04 字数 588 浏览 6 评论 0 原文

我有一个 DropDownList,它根据所选值填充 GridView。然后,我有一个 FormView,我想根据从 DataGrid 中选择的字段来填充数据。

我的 GridView 有 DataKeyNames="ID",然后我使用以下命令来更新所选字段:

<项目模板> )">更新

我的 FormView 的 ObjectDataSource 使用以下内容:

当用户单击网格中的“更新”时,我似乎仍然无法让 FormView 填充正确的数据,或者根本无法填充任何数据。

有什么想法吗?

I have a DropDownList that populates a GridView according to the selected value. I then have a FormView that I want to populate with data depending on what field was selected out of the DataGrid.

My GridView has DataKeyNames="ID", and I then use the following to update the selected field:

<ItemTemplate>
<a href="#" onclick="addEdit(<%# Eval("ID") %>)">Update</a>
</ItemTemplate>

My FormView's ObjectDataSource uses the following:

<asp:ControlParameter ControlID="grvMain" Name="pID" PropertyName="SelectedValue"
Type="Int32" />

I still can't seem to get the FormView populated with the correct data, or any data at all for that matter, when user clicks on Update in the grid.

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

黑凤梨 2024-12-29 11:03:04

添加以下内容到 gridview

<asp:CommandField ShowSelectButton="True" />

应该创建一个选择按钮。

Add the following, to the gridview

<asp:CommandField ShowSelectButton="True" />

Should create a select button.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文