Subbu1999 wrote:In my grid view five columns only two columns or editable mode remaining three colums non editable mode
Readonly
From MSDN[^]:The ProductID column is non-editable due to the ReadOnly="True" setting in the associated BoundField. XML <asp:GridView ID="GridView1" Runat="server" DataSourceID="productDataSource" DataKeyNames="ProductID" AutoGenerateColumns="False" AllowPaging="True" BorderWidth="1px" BackColor="White" CellPadding="4" BorderStyle="None" BorderColor="#3366CC"> <FooterStyle ForeColor="#003399" BackColor="#99CCCC"></FooterStyle> <PagerStyle ForeColor="#003399" HorizontalAlign="Left" BackColor="#99CCCC"></PagerStyle> <HeaderStyle ForeColor="#CCCCFF" Font-Bold="True" BackColor="#003399"></HeaderStyle> <Columns> <asp:CommandField ShowEditButton="True"></asp:CommandField> <asp:BoundField ReadOnly="True" HeaderText="ProductID" InsertVisible="False" DataField="ProductID" SortExpression="ProductID"></asp:BoundField> <asp:BoundField HeaderText="Product" DataField="ProductName" SortExpression="ProductName"></asp:BoundField> <asp:BoundField HeaderText="Unit Price" DataField="UnitPrice" SortExpression="UnitPrice"> <ItemStyle HorizontalAlign="Right"></ItemStyle> </asp:BoundField> <asp:BoundField HeaderText="Units In Stock" DataField="UnitsInStock" SortExpression="UnitsInStock"> <ItemStyle HorizontalAlign="Right"></ItemStyle> </asp:BoundField> </Columns> <SelectedRowStyle ForeColor="#CCFF99" Font-Bold="True" BackColor="#009999"></SelectedRowStyle> <RowStyle ForeColor="#003399" BackColor="White"></RowStyle> </asp:GridView>
<asp:GridView ID="GridView1" Runat="server" DataSourceID="productDataSource" DataKeyNames="ProductID" AutoGenerateColumns="False" AllowPaging="True" BorderWidth="1px" BackColor="White" CellPadding="4" BorderStyle="None" BorderColor="#3366CC"> <FooterStyle ForeColor="#003399" BackColor="#99CCCC"></FooterStyle> <PagerStyle ForeColor="#003399" HorizontalAlign="Left" BackColor="#99CCCC"></PagerStyle> <HeaderStyle ForeColor="#CCCCFF" Font-Bold="True" BackColor="#003399"></HeaderStyle> <Columns> <asp:CommandField ShowEditButton="True"></asp:CommandField> <asp:BoundField ReadOnly="True" HeaderText="ProductID" InsertVisible="False" DataField="ProductID" SortExpression="ProductID"></asp:BoundField> <asp:BoundField HeaderText="Product" DataField="ProductName" SortExpression="ProductName"></asp:BoundField> <asp:BoundField HeaderText="Unit Price" DataField="UnitPrice" SortExpression="UnitPrice"> <ItemStyle HorizontalAlign="Right"></ItemStyle> </asp:BoundField> <asp:BoundField HeaderText="Units In Stock" DataField="UnitsInStock" SortExpression="UnitsInStock"> <ItemStyle HorizontalAlign="Right"></ItemStyle> </asp:BoundField> </Columns> <SelectedRowStyle ForeColor="#CCFF99" Font-Bold="True" BackColor="#009999"></SelectedRowStyle> <RowStyle ForeColor="#003399" BackColor="White"></RowStyle> </asp:GridView>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)