0
我真的不知道该怎么说这个问题,所以如果有人对我如何改进措辞有任何建议,我会很乐意改变它。如何获取GridView单元格中的值以传递前端的函数?
我需要知道如何从单击按钮的GridViewRow中获取单元格的值。我有以下的GridView:
<asp:GridView ID="Gv_MipData" AllowSorting="true" runat="server" CssClass="GridViewStyle"
PageSize="30" Width="100%" AllowPaging="true">
<RowStyle CssClass="RowStyle" />
<EmptyDataRowStyle CssClass="EmptyRowStyle" />
<PagerSettings Position="TopAndBottom" />
<PagerStyle CssClass="PagerStyle" />
<SelectedRowStyle CssClass="SelectedRowStyle" />
<HeaderStyle CssClass="HeaderStyle" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="GvBtnApprove" runat="server" CausesValidation="False" Style='display: block; width: 100px;'
CommandName="Approve" CssClass="buttonlggrid" Text="Approve" OnClick="ApproveButtonClick"
OnClientClick="return confirm('Are you sure you want to approve this suggestion?');"
Visible='<%# IsApproveVisible() %>'>
</asp:LinkButton>
<asp:LinkButton ID="GvBtnDeny" runat="server" CausesValidation="False" Style='display: block; width: 100px;'
CommandName="Deny" CommandArgument="<%#Container.DataItemIndex %>"
CssClass="buttonlggrid" Text="Deny" OnClick="DenyButtonClick">
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
你会发现,我在我的TemplateField
2点了LinkButton。第一个按钮GvBtnApprove
有一个绑定到其Visible
属性的功能。背后的IsApproveVisible()
函数的代码是在这里:
Protected Function IsApproveVisible(mip_status As String) As Boolean
If mip_status = "Pending" Then
Return True
ElseIf mip_status = "Approved" Then
Return False
Else
Return True
End If
End Function
该函数采用名为mip_status
参数。此参数的值保存在GridView中每行的单元格12中。我怎样才能得到这个值传递给IsApproveVisible()
函数?如果您想知道,我打算为GvBtnDeny
做同样的事情。任何帮助是极大的赞赏。
非常感谢!我知道必须有某种我想要的语法,但我无法在任何地方找到它。这工作像一个魅力。 – ic3man7019