I have that GridView
in the default "English" language
When I change the language using DropDownList
to "Urdu" the resource file change the language to "Urdu" but the alignment of cells don't remain the same.
I think because "Urdu" is the RTL Language that is why it is changing the layout.
I want to preserve the layout of GridView
. Thank you
Here is the code:
<asp:GridView DataKeyNames="id" Width="455px" ID="gvProducts" runat="server" AutoGenerateColumns="False" CssClass="grid" BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" DataSourceID="dsCandidate" GridLines="Horizontal" AutoGenerateDeleteButton="True" AutoGenerateEditButton="True" meta:resourcekey="gvProductsResource1">
<AlternatingRowStyle BackColor="#F7F7F7" />
<Columns>
<asp:BoundField DataField="id" HeaderText="Id" InsertVisible="False" ReadOnly="True" SortExpression="id" meta:resourcekey="BoundFieldResource1" />
<asp:BoundField DataField="name" HeaderText="Name" SortExpression="name" meta:resourcekey="BoundFieldResource2" />
<asp:TemplateField HeaderText="Qualification" meta:resourcekey="TemplateFieldResource1">
<ItemTemplate>
<asp:Label ID="lblQuali" runat="server" Text='<%# Eval("Q_Type") %>' meta:resourcekey="lblQualiResource1"></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddl" runat="server" DataSourceID="dsQualification" DataValueField="Q_Id" DataTextField="Q_Type" SelectedValue='<%# Bind("Q_Id") %>' meta:resourcekey="ddlResource1"></asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="address" HeaderText="Address" SortExpression="address" meta:resourcekey="BoundFieldResource3" />
<asp:CheckBoxField DataField="active" HeaderText="Active" SortExpression="active" meta:resourcekey="CheckBoxFieldResource1" />
</Columns>
<FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
<SortedAscendingCellStyle BackColor="#F4F4FD" />
<SortedAscendingHeaderStyle BackColor="#5A4C9D" />
<SortedDescendingCellStyle BackColor="#D8D8F0" />
<SortedDescendingHeaderStyle BackColor="#3E3277" />
</asp:GridView>
You can set/align
HeaderStyle-Width
orItemStyle-HorizontalAlign
to your all templates of GridView.Or you can do it dynamically in
RowDataBound
event like: