本文介绍了网格命令字段 - 命名按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<asp:GridView ID="GvRegDtls" DataKeyNames="Pid" runat="server" AutoGenerateColumns="False"

OnRowEditing="GvRegDtls_OnRowEditing">
<Columns>
<asp:BoundField DataField="Name" HeaderText="Name" ReadOnly="True" />

<asp:CommandField ButtonType="Button" HeaderText="Edit" EditText="" CancelText=""

DeleteText="" InsertText="" InsertVisible="False" NewText="" SelectText=""

ShowCancelButton="False" UpdateText="" ShowEditButton="True" />
</Columns>
</asp:GridView>

---------------

in the above gridview , if i give name for command field's -- EditText , then if this commandfield( and normal button outside the grid is clicked),which triggers edit button(commandfield) to hide and automatically renders update & cancel button in that place. I don't require these button but i want to name the Command field button as Edit.

推荐答案

In save button click event add line


gvFinancialdtls.EditIndex = -1; //Turn the Grid to read only mode

        BindGridView(); // Rebind GridView to reflect changes made


这篇关于网格命令字段 - 命名按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 00:38