我正在尝试使用带有按钮的 GetSelectedFieldValues 方法从 ASPxGridView 中的选定行中获取一个值这样简单的事情。
我已经按照 DevExpress 文档中的步骤操作,不同之处在于我想检索标签内的值。经典的 ASPGridView 没什么难的。
Protected Sub ASPxButton1_Click(sender As Object, e As EventArgs) Handles ASPxButton1.Click
Dim oRowVal As List(Of Object)
Dim oVal As Object
oRowVal = ASPxGridView1.GetSelectedFieldValues({"No_"})
oVal = oRowVal(0)
Label1.Text = oVal.ToString
End Sub
如您所见,我想要的是在 ASPxGridView 中获取选定的值并将其显示在标签中。
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<br />
<dx:ASPxButton ID="ASPxButton1" runat="server" AutoPostBack="False" Text="ASPxButton" Theme="BlackGlass" Width="150px">
</dx:ASPxButton>
<dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" EnableTheming="True" Theme="BlackGlass">
<Columns>
<dx:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0">
<ClearFilterButton Visible="True">
</ClearFilterButton>
</dx:GridViewCommandColumn>
<dx:GridViewDataTextColumn Caption="GP" FieldName="No_" VisibleIndex="1">
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn Caption="Description" FieldName="Descripción Grupo" VisibleIndex="2">
</dx:GridViewDataTextColumn>
</Columns>
<SettingsBehavior AllowSelectSingleRowOnly="True" />
<Settings ShowFilterRow="True" ShowGroupPanel="True" />
</dx:ASPxGridView>
提前致谢!!!