khiery
khiery

Reputation: 31

Master page content going out of placeholder

i have a gridview inside content page , but it always goes out of the placeholder of the master page.. i want the gridview to integrate with the width of the place holder, any help please.

I tried to change the width of the grid, but nothing happened.

<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>

Upvotes: 3

Views: 379

Answers (2)

Ullas
Ullas

Reputation: 11556

Place the gridview inside a div and giv overflow for the div as follows.

<div style="overflow-x:scroll;overflow-y:scroll;">
    <asp:gridview id="grid1" runat="server" />
</div>

Upvotes: 0

Bashar Abu Shamaa
Bashar Abu Shamaa

Reputation: 2029

make the width 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%">

Upvotes: 1

Related Questions