IE7 Disappearing Content

Last post 07-06-2009 6:08 PM by tmk8789. 8 replies.

Sort Posts:

  • IE7 Disappearing Content

    06-30-2009, 12:59 PM
    • Member
      18 point Member
    • tmk8789
    • Member since 06-07-2009, 4:58 PM
    • Posts 57

    Hi all...I have a page on which I hide a gridview control until the user searches for content, then I display the grid inside an AJAX Update Panel for additional manipulation.  This works perfectly in Chrome, but in IE7....When I click the "search" button the gridview displays for 1 second with the correct information, then re-hides itself.  I've Googled this until I'm blue in the face and can't figure out what's wrong.  Like I said, Chrome renders this beautifully.  Can someone point me in the right direction?  Thanks.

  • Re: IE7 Disappearing Content

    06-30-2009, 1:19 PM
    • Contributor
      5,624 point Contributor
    • RatheeshC
    • Member since 04-25-2008, 6:05 PM
    • Posts 1,198

    How did you hide the grid..?

    Using some javascript or from code behind..Put some code here ..

    Thanks

    Thanks
    Ratheesh

    Please mark it as answer if it resolves your issue.
  • Re: IE7 Disappearing Content

    06-30-2009, 4:23 PM
    • Member
      18 point Member
    • tmk8789
    • Member since 06-07-2009, 4:58 PM
    • Posts 57

     Hi.  Thanks for replying.  The gridview's visible state is set to false from the beginning and I use VB code to set it to true on certain events that occur on the page.  I've posted the Gridview markup below along with the VB code event that invokes the change.  Thanks for any help.

    <asp:GridView ID="MatchingRecipesDataGrid" runat="server" AutoGenerateColumns="False"
                        DataSourceID="GetMatchingRecipesDataSource" DataKeyNames="RECIPE_ID" 
                        AllowSorting="True" AllowPaging="True" PageSize="15" 
                        OnSelectedIndexChanged="MatchingRecipesDataGrid_SelectedIndexChanged"
                        OnPageIndexChanging="RebindGridonPageChange" 
                        Visible="False" BorderStyle="None">
                        
                        <Columns>
                            <asp:CommandField SelectText="Details" ShowSelectButton="True">
                                <ControlStyle ForeColor="#5C0025" />
                            </asp:CommandField>
                            <asp:BoundField DataField="RECIPE_ID" HeaderText="ID" 
                                SortExpression="RECIPE_ID">
                                <HeaderStyle ForeColor="#5C0025"/>
                                <ItemStyle ForeColor="#164B7D" HorizontalAlign="Center" />
                            </asp:BoundField>
                            <asp:BoundField DataField="RECIPE_NAME" HeaderText="Recipe Name" 
                                SortExpression="RECIPE_NAME" >
                                <HeaderStyle ForeColor="#5C0025" />
                                <ItemStyle ForeColor="#164B7D" />
                            </asp:BoundField>
                            <asp:BoundField DataField="RECIPE_CATEGORY" HeaderText="Recipe Category" 
                                SortExpression="RECIPE_CATEGORY" >
                                <HeaderStyle ForeColor="#5C0025" />
                                <ItemStyle ForeColor="#164B7D" HorizontalAlign="Center" Width="50px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="RECIPE_TYPE" HeaderText="Recipe Type" 
                                SortExpression="RECIPE_TYPE" >
                                <HeaderStyle ForeColor="#5C0025" />
                                <ItemStyle ForeColor="#164B7D" HorizontalAlign="Center" Width="50px" />
                            </asp:BoundField>
                            <asp:TemplateField HeaderText="My Recipe">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Image ID="MyRecipeImage" runat="server" Height="15px" 
                                        ImageUrl="~/Images/PantryPlannerLogo.png" />
                                    <asp:LinkButton ID="AddLinkButton" runat="server" ForeColor="#5C0025" onclick="AddLinkButton_Click" >Add</asp:LinkButton>
                                </ItemTemplate>
                                <HeaderStyle ForeColor="#5C0025" />
                                <ItemStyle HorizontalAlign="Center" Width="40px" />
                            </asp:TemplateField>
                        </Columns>
                        <SelectedRowStyle BackColor="#FFFFC0" ForeColor = "#FFFFFF" Font-Bold="True" />
                    </asp:GridView>


     

    Protected Sub Search_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Search.Click
            MatchingRecipesDataGrid.Visible = "True"
            GetMatchingRecipesDataSource.DataBind()
            myHeaderMessage.Text = ""
            myFooterMessage.Text = ""
            IngredientsforRecipe.Visible = False
            StepsforRecipe.Visible = False
        End Sub


  • Re: IE7 Disappearing Content

    06-30-2009, 4:36 PM
    • Contributor
      5,624 point Contributor
    • RatheeshC
    • Member since 04-25-2008, 6:05 PM
    • Posts 1,198

     Hi,

    Instead of setting the visible property to false try to set a cssclass which have "display:none";

    eg: Css

    .Hide
        {
          display:none;
        }

    <asp:GridView ID="gv" runat="server"  CssClass="Hide" />

     

    Thanks

    Thanks
    Ratheesh

    Please mark it as answer if it resolves your issue.
  • Re: IE7 Disappearing Content

    06-30-2009, 5:53 PM
    • Member
      18 point Member
    • tmk8789
    • Member since 06-07-2009, 4:58 PM
    • Posts 57

     Thanks for the idea.  Before I implement it though, can I set the CSS Class on the fly with VB code in the backend?  If so, what is the property that set's it back to visible?  Thanks!

  • Re: IE7 Disappearing Content

    06-30-2009, 5:57 PM
    • Contributor
      5,624 point Contributor
    • RatheeshC
    • Member since 04-25-2008, 6:05 PM
    • Posts 1,198

     Hi,

    Without a defining CSS class you can add that

    Gridview1.Attributes.Add("style", "display:none");

    if you are using any predefined CSS class then


    Gridview1.Attributes.Add("class", "cssStylehere");

     

    Thanks

    Thanks
    Ratheesh

    Please mark it as answer if it resolves your issue.
  • Re: IE7 Disappearing Content

    06-30-2009, 6:30 PM
    Answer
    • Member
      18 point Member
    • tmk8789
    • Member since 06-07-2009, 4:58 PM
    • Posts 57

     I tried your method.  In most cases, it would probably work, so I'm not discounting it as an acceptable method.  However, I have a variable that is declared on load that throws an error whenever I use this method.  Aparently the "visible" property allows for a delay in requesting the variable assignment of "selected row" and the CSS class does not.  The error I get is below when I attempt to dynamically set the CSS for the visible state.  In other words, on load, there is no "selectedrow", so it throws a Null reference error.  When I use the visible state property, it waits until the grid is fully loaded and visible to declare this variable.  Any thoughts on a better way to do this?

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
    
    Source Error: 
    
    
    Line 100:    End Sub
    Line 101:    Protected Sub AssignVariabletoIngredientLookup(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles SelectIngredientsDataSource.Selecting
    Line 102:        e.Command.Parameters("@Recipe_id").Value = MatchingRecipesDataGrid.SelectedRow.Cells(1).Text
    Line 103:    End Sub
    Line 104:    Protected Sub AssignVariabletoStepLookup(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles GetRecipeStepsDataSource.Selecting
    


     

  • Re: IE7 Disappearing Content

    07-06-2009, 9:13 AM
    • Member
      18 point Member
    • tmk8789
    • Member since 06-07-2009, 4:58 PM
    • Posts 57

    The problem ended up being with the "haslayout" property on the page.  I simply added a width parameter = 100% to the parent content area and viola!  Page reference for more info is http://www.satzansatz.de/cssd/onhavinglayout.html.  Thanks all who tried to help.  This cross-browser stuff can be very tricky; or so I'm learning!

  • Re: IE7 Disappearing Content

    07-06-2009, 6:08 PM
    • Member
      18 point Member
    • tmk8789
    • Member since 06-07-2009, 4:58 PM
    • Posts 57

    Well guys, I thought I had the answer.  Turns out, that fixed the problem on one page, but for the life of me, I can't get it to work on this page below.  I've spent days scouring the internet looking for a solutions to no avail.  I think it has something to do with the IE haslayout bug, but I don't know what to do to correct it.  I've tried about 1000 things with no luck so I'm posting my code for some desperately needed help!  This page works perfectly in Chrome, but in IE7, it displays for 1 second, then disappears.  The visible state on the gridview is false, but my code-behind sets it to true when the search button is clicked; and yes, I've tried setting it to true all the time and it doesn't work.  Thanks all!

    Protected Sub Search_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Search.Click
            MatchingRecipesDataGrid.Visible = True
            GetMatchingRecipesDataSource.DataBind()
            myHeaderMessage.Text = ""
            myFooterMessage.Text = ""
            IngredientsforRecipe.Visible = False
            StepsforRecipe.Visible = False
            'MatchingRecipesDataGrid.DataBind()
        End Sub



        <style type="text/css">
    
            .style10
            {
                width: 428px;
            }
            .style12
            {
                color: #1D3362;
            }
            .style13
            {
                width: 308px;
            }
            .selectedrowstyle
            {
                color: #FFFFFF;
                background-color: #500000;
            }
        </style>
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
            <Services>
                <asp:ServiceReference Path="WebService.asmx" />
            </Services>
        </asp:ScriptManager>
        <cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" MinimumPrefixLength="1"
            ServicePath="WebService.asmx" ServiceMethod="GetItemList" TargetControlID="SearchBox"
            CompletionSetCount="10" />
        <asp:TextBox ID="SearchBox" runat="server" Width="279px"></asp:TextBox>
        <asp:DropDownList ID="DropDownList1" runat="server">
            <asp:ListItem Value="All Recipes"></asp:ListItem>
            <asp:ListItem Value="My Recipes"></asp:ListItem>
            <asp:ListItem Value="Public Recipes"></asp:ListItem>
        </asp:DropDownList>
        <asp:LinkButton ID="Search" runat="server" ForeColor="#500000">Search Keywords</asp:LinkButton>
          
        <asp:LinkButton ID="LinkButton1" runat="server" ForeColor="#500000">Clear Search</asp:LinkButton>
        <br />
        <br />
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="slider1" EventName="textchanged" />
            </Triggers>
            <ContentTemplate>
                
                <asp:Panel ID="Panel1" runat="server" >
                    <cc1:RoundedCornersExtender ID="RoundedCornersExtender1" runat="server" Color="80, 0, 0"
                        Radius="10" TargetControlID="Panel1" />
                    <table>
                        <tr>
                            <td>
                                <asp:SqlDataSource ID="GetMatchingRecipesDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:TekComConnection %>"
                                    SelectCommand="SELECT A.RECIPE_ID, A.RECIPE_NAME, A.RECIPE_CATEGORY, A.RECIPE_TYPE FROM TB_RECIPE AS A LEFT OUTER JOIN TB_RECIPE_USER_DETAILS AS C ON A.RECIPE_ID = C.RECIPE_ID LEFT OUTER JOIN TB_INGREDIENTS AS B ON A.RECIPE_ID = B.RECIPE_ID WHERE ((A.PUBLIC_STATUS = @PublicStatus OR A.PUBLIC_STATUS = @PublicStatus2) AND (B.INGREDIENT_NAME LIKE @SearchTerm) AND (C.USER_ID LIKE @RecipeOwner)) OR ((A.PUBLIC_STATUS = @PublicStatus OR A.PUBLIC_STATUS = @PublicStatus2) AND (A.RECIPE_NAME LIKE @SearchTerm) AND (C.USER_ID LIKE @RecipeOwner)) GROUP BY A.RECIPE_ID, A.RECIPE_NAME, A.RECIPE_CATEGORY, A.RECIPE_TYPE ORDER BY A.RECIPE_NAME">
                                    <SelectParameters>
                                        <asp:Parameter Name="PublicStatus" />
                                        <asp:Parameter Name="PublicStatus2" />
                                        <asp:Parameter Name="SearchTerm" />
                                        <asp:Parameter Name="RecipeOwner" />
                                    </SelectParameters>
                                </asp:SqlDataSource>
                                <span class="style12">
                                    <asp:Label ID="Label3" runat="server" Visible="false" Text="Use this slider to change the number of items per page." />
                                    <br />
                                    <asp:Label ID="YouCanNowSee" runat="server" Visible="false" Text="You can now see " />
                                    <asp:Label ID="SliderValueDisplay" Visible="false" runat="server" />
                                    <asp:Label ID="ItemsPerPage" runat="server" Visible="false" Text=" items per page." />
                                </span>
                                <br />
                                <asp:TextBox ID="Slider1" runat="server" Visible="false" Text="3" AutoPostBack="true"></asp:TextBox>
                                <!--<asp:TextBox ID="Slider1_BoundControl" runat="server"></asp:TextBox>-->
                                <cc1:SliderExtender ID="Slider1Extender" runat="server" TargetControlID="Slider1"
                                    BoundControlID="SliderValueDisplay" Orientation="Horizontal" EnableHandleAnimation="true"
                                    Minimum="3" Maximum="35" />
                                <br />
                                <asp:Label ID="myHeaderMessage" runat="server" Style="color: #500000"></asp:Label>
                                <br />
                                <cc1:RoundedCornersExtender ID="RoundedCornersExtender2" runat="server" Color="29, 51, 98"
                                    Radius="10" TargetControlID="MatchingRecipesDataGrid">
                                </cc1:RoundedCornersExtender>
                                
                                <asp:GridView ID="MatchingRecipesDataGrid" runat="server" AutoGenerateColumns="False"
                                                                           DataSourceID="GetMatchingRecipesDataSource" 
                                                                           DataKeyNames="RECIPE_ID" 
                                                                           AllowSorting="True"
                                                                           AllowPaging="True" 
                                                                           ForeColor="#1D3362" 
                                                                           OnSelectedIndexChanged="MatchingRecipesDataGrid_SelectedIndexChanged"
                                                                           OnPageIndexChanging="ResetDetails" 
                                                                           Visible="False" 
                                                                           BorderStyle="None">
                                    <Columns>
                                        <asp:CommandField SelectText="Details" ShowSelectButton="True">
                                            <ControlStyle ForeColor="#500000" />
                                        </asp:CommandField>
                                        <asp:BoundField DataField="RECIPE_ID" HeaderText="ID" SortExpression="RECIPE_ID">
                                            <HeaderStyle ForeColor="#EEE1C6" Font-Size="1" Width="2px" />
                                            <ItemStyle HorizontalAlign="Center" Font-Size="1" ForeColor="#EEE1C6" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="RECIPE_NAME" HeaderText="Recipe Name" SortExpression="RECIPE_NAME">
                                            <HeaderStyle ForeColor="#500000" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="RECIPE_CATEGORY" HeaderText="Recipe Category" SortExpression="RECIPE_CATEGORY">
                                            <HeaderStyle ForeColor="#500000" />
                                            <ItemStyle HorizontalAlign="Center" Width="50px" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="RECIPE_TYPE" HeaderText="Recipe Type" SortExpression="RECIPE_TYPE">
                                            <HeaderStyle ForeColor="#500000" />
                                            <ItemStyle HorizontalAlign="Center" Width="50px" />
                                        </asp:BoundField>
                                        <asp:TemplateField HeaderText="My Recipe">
                                            <ItemTemplate>
                                                <asp:Image ID="MyRecipeImage" runat="server" Height="15px" ImageUrl="~/Images/PantryPlannerLogo.png" />
                                                <asp:LinkButton ID="AddLinkButton" runat="server" ForeColor="#500000" OnClick="AddLinkButton_Click">Add</asp:LinkButton>
                                            </ItemTemplate>
                                            <HeaderStyle ForeColor="#500000" />
                                            <ItemStyle HorizontalAlign="Center" Width="40px" />
                                        </asp:TemplateField>
                                    </Columns>
                                    <SelectedRowStyle BackColor="#CBCA99" ForeColor="#500000"  />
                                </asp:GridView>
                                
                                <asp:Label ID="myFooterMessage" runat="server" ForeColor="#500000"></asp:Label>
                            </td>
                            
                            <td>
                                <asp:SqlDataSource ID="SelectIngredientsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:TekComConnection %>"
                                    SelectCommand="SELECT [INGREDIENT_NAME], [QUANTITY], [QUANTITY_FRACTION], [UNIT_OF_MEASURE] FROM [TB_INGREDIENTS] WHERE ([RECIPE_ID] = @RECIPE_ID) ORDER BY INGREDIENT_NAME">
                                    <SelectParameters>
                                        <asp:Parameter Name="RECIPE_ID" Type="Int32" />
                                    </SelectParameters>
                                </asp:SqlDataSource>
                                <cc1:RoundedCornersExtender ID="RoundedCornersExtender3" runat="server" Color="29, 51, 98"
                                    Radius="10" TargetControlID="IngredientsforRecipe">
                                </cc1:RoundedCornersExtender>
                                <asp:GridView ID="IngredientsforRecipe" runat="server" AutoGenerateColumns="False"
                                    DataSourceID="SelectIngredientsDataSource" ForeColor="#1D3362" AllowSorting="True"
                                    Visible="false" BorderStyle="None">
                                    <Columns>
                                        <asp:BoundField DataField="QUANTITY" HeaderText="Qty" SortExpression="QUANTITY">
                                            <HeaderStyle ForeColor="#500000" />
                                            <ItemStyle HorizontalAlign="Center" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="QUANTITY_FRACTION" HeaderText="Qty Fraction" SortExpression="QUANTITY_FRACTION">
                                            <HeaderStyle ForeColor="#500000" />
                                            <ItemStyle HorizontalAlign="Center" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="UNIT_OF_MEASURE" HeaderText="Unit of Measure" SortExpression="UNIT_OF_MEASURE">
                                            <HeaderStyle ForeColor="#500000" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="INGREDIENT_NAME" HeaderText="Ingredient" SortExpression="INGREDIENT_NAME">
                                            <HeaderStyle ForeColor="#500000" />
                                        </asp:BoundField>
                                    </Columns>
                                </asp:GridView>
                            </td>
                            <td>
                                <asp:SqlDataSource ID="GetRecipeStepsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:TekComConnection %>"
                                    SelectCommand="SELECT [RECIPE_STEP_ID], [STEP_NUMBER], [STEP_DESC] FROM [TB_RECIPE_STEPS] WHERE ([RECIPE_ID] = @RECIPE_ID) ORDER BY [RECIPE_STEP_ID]">
                                    <SelectParameters>
                                        <asp:Parameter Name="RECIPE_ID" Type="Int32" />
                                    </SelectParameters>
                                </asp:SqlDataSource>
                                <cc1:RoundedCornersExtender ID="RoundedCornersExtender4" runat="server" Color="29, 51, 98"
                                    Radius="10" TargetControlID="StepsforRecipe">
                                </cc1:RoundedCornersExtender>
                                <asp:GridView ID="StepsforRecipe" runat="server" AllowSorting="True" AutoGenerateColumns="False"
                                    ForeColor="#1D3362" DataSourceID="GetRecipeStepsDataSource" Visible="false" BorderStyle="None">
                                    <Columns>
                                        <asp:BoundField DataField="STEP_NUMBER" HeaderText="Step No." SortExpression="STEP_NUMBER">
                                            <HeaderStyle ForeColor="#500000" />
                                            <ItemStyle HorizontalAlign="Center" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="STEP_DESC" HeaderText="Description" SortExpression="STEP_DESC">
                                            <HeaderStyle ForeColor="#500000" />
                                        </asp:BoundField>
                                    </Columns>
                                </asp:GridView>
                            </td>
                        </tr>
                    </table>
                    <br />
                </asp:Panel>
            </ContentTemplate>
        </asp:UpdatePanel>
    </asp:Content>
    <asp:Content ID="Content3" ContentPlaceHolderID="ActionButtons" runat="Server">
    </asp:Content>
    <asp:Content ID="Content4" ContentPlaceHolderID="AddSteps" runat="Server">
    </asp:Content>
    



Page 1 of 1 (9 items)