通过对象数据源访问radgrid行

发布于 2024-09-16 12:08:31 字数 696 浏览 4 评论 0原文

我有一个 radgrid,在所说的 radgrid 中,我有一个模板列,它是一个可爱的下拉列表:

<telerik:GridTemplateColumn HeaderText="Feedback" UniqueName="Feedback">
                            <ItemTemplate>
                                <asp:DropDownList ID="ddlFeedback" runat="server" AppendDataBoundItems="True" AutoPostBack="True" OnSelectedIndexChanged="ddlFeedback_SelectedIndexChanged">  
                               </asp:DropDownList>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>

我的 radgrid 中有一个列,它是主键,它有一个可爱的值。

如何从下拉列表的 SelectedIndexChanged 事件上的 radgrid 获取主键值,即本质上找到下拉列表已更改的 radgrid 行?

I have a radgrid and within said radgrid, I have a templatecolumn that is a lovely drop down list:

<telerik:GridTemplateColumn HeaderText="Feedback" UniqueName="Feedback">
                            <ItemTemplate>
                                <asp:DropDownList ID="ddlFeedback" runat="server" AppendDataBoundItems="True" AutoPostBack="True" OnSelectedIndexChanged="ddlFeedback_SelectedIndexChanged">  
                               </asp:DropDownList>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>

I have a column in my radgrid that is the primary key and it has a lovely value in it.

How can I get the primary key value from the radgrid on the SelectedIndexChanged event of the drop down list i.e. essentially finding the row of the radgrid where the drop down list has been changed?

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

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

发布评论

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

评论(1

月亮坠入山谷 2024-09-23 12:08:32

找到了。谢谢!

DropDownList ddlFeedback = (DropDownList)sender;
            GridDataItem item = (GridDataItem)ddlFeedback.NamingContainer;
            String prikey = item.GetDataKeyValue("PriKey").ToString();

Found it. Thanks!

DropDownList ddlFeedback = (DropDownList)sender;
            GridDataItem item = (GridDataItem)ddlFeedback.NamingContainer;
            String prikey = item.GetDataKeyValue("PriKey").ToString();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文