Reputation: 260
I want to have 2 or more controls(e.g. gridview controls) aligned horizontally.
Optional: I want to have 1 gridview control and 1 Image control in the same row (horizontally).
I tried the following controls..
MultiView: Only vertical alignment possible
WebPartZone: It looked good in design mode, but gave me an error (something with the App_Data folder) and I think there must be a more simple approach.
I can have 2 Image controls horizontally.But Why not 2 gridviews?
Upvotes: 0
Views: 5445
Reputation: 5636
Try to put your Grid view inside Div as per mentioned by mikeshorts or use an another way like use table.
<table>
<tr>
<td>
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</td>
<td>
<asp:GridView ID="GridView2" runat="server">
</asp:GridView>
</td>
</tr>
</table>
or you just use HorizontalAlign property like
<asp:GridView ID="GridView1" runat="server" HorizontalAlign="Left" >
</asp:GridView>
<asp:GridView ID="GridView2" runat="server" HorizontalAlign="Right" >
</asp:GridView>
i hope it will work for you.
Upvotes: 2
Reputation: 71
HI Please check this aricle http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.horizontalalign.aspx
Hope its helpful to you.
Upvotes: 1
Reputation: 330
Try putting them as two separate divs.... something like this:
<div style="float:left; position:relative;">
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</div>
<div style="float:right; position:relative;">
<asp:GridView ID="GridView2" runat="server">
</asp:GridView>
</div>
Upvotes: 2