开发者

Need to make a specific column editable upon clicking edit

开发者 https://www.devze.com 2023-02-05 23:04 出处:网络
I have a gridview with \"Edit Update Cancel\" command field. When I click Edit, all the columns in the particular row becomes editable.

I have a gridview with "Edit Update Cancel" command field. When I click Edit, all the columns in the particular row becomes editable. I just need to have 2 specific columns editable. How is that made possible ?

(Screen Shot Attached)

Need to make a specific column editable upon clicking edit

[In the screen shot all 3 columns are editable, I just need the secon开发者_Go百科d and third to be editable]

Thanks in Advance.


Just set the other columsn to read-only:

 <asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True"  />


It is very easy. The column you want not editable then place just label and bind properly.

<EditItemTemplate>
 <asp:Label Runat="server" Text='<%# Bind("UnitPrice", "{0:c}") %>' ID="Label1"></asp:Label>
</EditItemTemplate>

Here I use label in my EditItemTemplate because when the user clicks on edit button, the textbox will not come up. Rather, the value for that record will show through label, and as a result the user can not update that field.

0

精彩评论

暂无评论...
验证码 换一张
取 消