我在内容页面中有一个gridview,但它总是在主页面的占位符之外。我希望gridview与占位符的宽度集成,请任何帮助。
我试图改变网格的宽度,但没有发生任何事情。
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<br />
<br />
<br />
<div dir="rtl">
<h2 dir="rtl">نتائج البحث</h2>
<h3 runat="server" id="H3_NoResult" dir="rtl"></h3>
<asp:GridView ID="GV_SearchResult" runat="server" AutoGenerateColumns="False" DataKeyNames="AutoNo" DataSourceID="SDS_GetSearchResult" CellPadding="4" ForeColor="#333333" GridLines="None" AllowPaging="True" PageSize="300" AllowSorting="True">
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField DataField="AutoNo" HeaderText="رقم الطعام" InsertVisible="False" ReadOnly="True" SortExpression="AutoNo" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" >
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundField>
<asp:HyperLinkField DataTextField="NameAr" HeaderText="اسم العربي للطعام" DataNavigateUrlFields="AutoNo"
DataNavigateUrlFormatString="FoodItem.aspx?AutoNo={0}" SortExpression="NameAr" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" >
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:HyperLinkField>
<asp:BoundField DataField="NameEn" HeaderText="الاسم الانجليزي للطعام" SortExpression="NameEn" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" >
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="NameDescAr" HeaderText="وصف الطعام بالعربي" SortExpression="NameDescAr" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" >
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="NameDescEn" HeaderText="وصف الطعام بالإنجليزي" SortExpression="NameDescEn" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" >
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="FoodCatName" HeaderText="صنف الطعام" ReadOnly="True" SortExpression="FoodCatName" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" >
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundField>
<asp:TemplateField HeaderText="الصورة" SortExpression="ImgLink">
<ItemTemplate>
<a href="Recipe.aspx?FoodNo=<%# Eval("AutoNo") %>"> <asp:Image ID="Img_TopicImage" AlternateText="لا يوجد صورة" runat="server" Height="70px" Width="100px" ImageUrl='<%#String.Format("../RecipeImages/{0}", Eval("ImgLink")) %>' /></a>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center" />
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
</Columns>
<EditRowStyle BackColor="#7C6F57" />
<FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#557c12" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#E3EAEB" />
<SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#F8FAFA" />
<SortedAscendingHeaderStyle BackColor="#246B61" />
<SortedDescendingCellStyle BackColor="#D4DFE1" />
<SortedDescendingHeaderStyle BackColor="#15524A" />
</asp:GridView>
<asp:SqlDataSource ID="SDS_GetSearchResult" runat="server" ConnectionString="<%$ ConnectionStrings:dietdbCS %>" SelectCommand="GetFoodListTBL_By_FoodName_By_FoodDescs" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:QueryStringParameter DefaultValue="" Name="FoodName" QueryStringField="val" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</div>
</asp:Content>
答案 0 :(得分:1)
使宽度gridview = 100%
<asp:GridView ID="GV_SearchResult" runat="server" AutoGenerateColumns="False" DataKeyNames="AutoNo" DataSourceID="SDS_GetSearchResult" CellPadding="4" ForeColor="#333333" GridLines="None" AllowPaging="True" PageSize="300" AllowSorting="True" width="100%">
答案 1 :(得分:0)
将gridview放在div的div和giv溢出中,如下所示。
<div style="overflow-x:scroll;overflow-y:scroll;">
<asp:gridview id="grid1" runat="server" />
</div>