Dec 18 2009

Gridview BoundField row textbox width changing in EditMode

Add controlStyle property inbetween BoundField  control

<ControlStyle Width=”50px” />

———————————————————————————————————

<asp:BoundField DataField=”LOPDays” HeaderText=”LOPDays” >

<ControlStyle Width=”50px” />

</asp:BoundField>

—————————————————————————————————————-

Sample Design code

<asp:GridView ID=”GridView1″ runat=”server” AutoGenerateColumns=”False”

onrowediting=”GridView1_RowEditing” DataKeyNames=”EmpSalID”

onrowcancelingedit=”GridView1_RowCancelingEdit” Width=”900px”

onrowupdating=”GridView1_RowUpdating” ForeColor=”Black” GridLines=”None” >

<FooterStyle BackColor=”#1C5E55″ Font-Bold=”True” ForeColor=”White” />

<RowStyle BackColor=”#E3EAEB” /> <Columns>

<asp:BoundField DataField=”EmpName” HeaderText=”EmployeeName” ReadOnly=”True” />

<asp:BoundField DataField=”EmpCode” HeaderText=”EmpCode” ReadOnly=”True” />

<asp:BoundField DataField=”Salary” HeaderText=”Salary” ReadOnly=”True” />

<asp:BoundField HeaderText=”MonthYear” ReadOnly=”True” />

<asp:BoundField DataField=”LOPDays” HeaderText=”LOPDays” >

<ControlStyle Width=”50px” />

</asp:BoundField>

<asp:BoundField DataField=”Bonus” HeaderText=”Bonus” >

<ControlStyle Width=”100px” />

</asp:BoundField>

<asp:CommandField ShowEditButton=”true”  >                                                                                <ControlStyle Width=”50″ />

</asp:CommandField>

</Columns>

<HeaderStyle BackColor=”#1C5E55″ Font-Bold=”True” ForeColor=”Black”

CssClass=”strip” />

<EditRowStyle BackColor=”#7C6F57″ />

<AlternatingRowStyle BackColor=”White” />

</asp:GridView>

Alibi3col theme by Themocracy