Arthi Dev

Arthi Dev

  • NA
  • 3
  • 2.2k

Making some column editable and some column noneditable using the asp:datagrid

Apr 29 2012 9:54 PM
Hi,
   In my datagrid i have 9 columns. In that 4 column should be noneditable. If i use the readonly property in the design mode. Always the column in noneditable. But for me when i click on the checkbox, if it is true then that particular 4 column should be noneditable . If the checkbox is false, all the 9 column should be editable. For me all the column editable is working fine. But i have problem with the column nonediting.
In the design page i wrote as:

<

asp:TemplateColumn HeaderText="IPAddress">


<ItemTemplate>


<asp:TextBox ID="txtaddress" runat="server" Text='<%# DataBinder.Eval(Container, &#13;&#10; "DataItem.Ipaddress") %>' Enabled="false" />


</ItemTemplate>


<EditItemTemplate>


<asp:TextBox ID="txtaddress" runat="server" Text='<%# DataBinder.Eval(Container, &#13;&#10; "DataItem.Ipaddress") %>'/>


</EditItemTemplate>



</asp:TemplateColumn>

In the edit command i wrote as below

((TextBox)e.Item.FindControl("txtaddress")).ReadOnly = true;

Please help me with this question.


Answers (4)