This is a migrated thread and some comments may be shown as answers.

Row Disappears on PostBack

1 Answer 68 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brett
Top achievements
Rank 2
Brett asked on 02 Sep 2008, 07:13 PM
I have Cleint Side Row Select enabled, as well as EnablePostBackOnRowClick, for some reason, after the PostBack completes, the "selected" row disappears from the grid.  I have thios working on another page which searches by Address instead of Roll Number and it works fine.  Does anyone see anything that might be causing this....

<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" 
    CodeFile="byRoll.aspx.vb" Inherits="byRoll" %> 
 
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">  
    <style type="text/css">  
        .style1  
        {  
            font-size: xx-small;  
            font-style: italic;  
        }  
    </style> 
</asp:Content> 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">  
    <div id="searchblock">  
        <cc1:TextBoxWatermarkExtender ID="tbwm1" runat="server" TargetControlID="txtSearch" 
            WatermarkText="401015084000000" WatermarkCssClass="txtWatermark">  
        </cc1:TextBoxWatermarkExtender> 
        <asp:TextBox ID="txtSearch" runat="server"></asp:TextBox> 
        <asp:Button ID="btnSearch" runat="server" Text="Search" /> 
        <telerik:RadToolTip ID="RadToolTip1" runat="server" Animation="Fade" AutoCloseDelay="5000" 
            ShowDelay="100" Skin="Hay" TargetControlID="txtSearch" Text="Please enter one complete Roll No." 
            VisibleOnPageLoad="False">  
        </telerik:RadToolTip> 
    </div> 
    <p> 
        <asp:Label ID="lblError" runat="server" ForeColor="#FF3300"></asp:Label> 
    </p> 
    <asp:Panel ID="pnlDetails" runat="server" Visible="False">  
        <div class="tablehdr">  
            <h3> 
                Municipal Property Details</h3> 
             <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="dsGrid" Skin="Telerik" 
        GridLines="None" AllowPaging="True" PageSize="5">  
        <MasterTableView AutoGenerateColumns="False" DataSourceID="dsGrid" DataKeyNames="ROLL_NO">  
            <RowIndicatorColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </RowIndicatorColumn> 
            <ExpandCollapseColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </ExpandCollapseColumn> 
            <Columns> 
                <telerik:GridBoundColumn DataField="ROLL_NO" HeaderText="Roll Number" SortExpression="ROLL_NO" 
                    UniqueName="ROLL_NO">  
                </telerik:GridBoundColumn> 
                     <telerik:GridTemplateColumn HeaderText="Address" UniqueName="TemplateColumn">  
                    <ItemTemplate> 
                        <asp:Label ID="lblStNum" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.STREET_NO") %>'>  
                        </asp:Label>&nbsp;<asp:Label ID="lblStName" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.STREET_NAME") %>'>  
                        </asp:Label> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
                  
                <telerik:GridTemplateColumn HeaderText="Legal Description" UniqueName="TemplateColumn">  
                    <ItemTemplate> 
                        <asp:Label ID="Label58" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.LEGAL1") %>'>  
                        </asp:Label><br /> 
                        <asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.LEGAL2") %>'>  
                        </asp:Label><br /> 
                        <asp:Label ID="Label2" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.LEGAL3") %>'>  
                        </asp:Label><br /> 
                        <asp:Label ID="Label3" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.LEGAL4") %>'>  
                        </asp:Label><br /> 
                        <asp:Label ID="Label4" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.LEGAL5") %>'>  
                        </asp:Label> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridBoundColumn DataField="CLASS" HeaderText="Class" SortExpression="CLASS" 
                    UniqueName="CLASS">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="ASSESSMENT" DataType="System.Decimal" HeaderText="Assesed Value" 
                    SortExpression="ASSESSMENT" UniqueName="ASSESSMENT" DataFormatString="{0:c}">  
                </telerik:GridBoundColumn> 
             <%--   <telerik:GridHyperLinkColumn HeaderText="More Details" NavigateUrl="details.aspx?txtSearch={0}" 
                    Text="View Details" UniqueName="column" DataNavigateUrlFields="ROLL_NO">  
                    <HeaderStyle HorizontalAlign="Center" /> 
                    <ItemStyle HorizontalAlign="Center" /> 
                </telerik:GridHyperLinkColumn>--%> 
            </Columns> 
        </MasterTableView> 
        <ClientSettings EnablePostBackOnRowClick="True">  
            <Selecting AllowRowSelect="True" /> 
        </ClientSettings> 
        <FilterMenu EnableTheming="True">  
            <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
        </FilterMenu> 
    </telerik:RadGrid> 
  <asp:SqlDataSource ID="dsGrid" runat="server" ConnectionString="<%$ ConnectionStrings:csProperty %>" 
        SelectCommand="SELECT txroll.ROLL_NO, txroll.STREET_NO, txroll.Street_Name, txroll.LEGAL1, txroll.LEGAL2, txroll.LEGAL3, txroll.LEGAL4, txroll.LEGAL5, TX_ROLL_ASSESS_SAS.CLASS, TX_ROLL_ASSESS_SAS.ASSESSMENT  
FROM TX_ROLL txroll LEFT OUTER JOIN TX_ROLL_ASSESS_SAS ON txroll.ROLL_NO = TX_ROLL_ASSESS_SAS.ROLL_NO    
WHERE txroll.ROLL_NO = @ROLL_NO"> 
        <SelectParameters> 
            <asp:ControlParameter Name="ROLL_NO" ControlID="txtSearch" Type="String" /> 
        </SelectParameters> 
    </asp:SqlDataSource> 
        </div> 
    </asp:Panel> 
      
    <asp:Panel ID="pnlStructure" runat="server" Visible="False">  
     <div class="tablehdr">  
            <h3> 
                Sturcture Details</h3> 
            <span class="style1">The information contained in this area of this web site   
            should be reviewed with caution as the details provided may not be up-to-date.</span></div>  
        <telerik:RadGrid ID="RadGrid2" runat="server" DataSourceID="dsStructure" GridLines="None" 
            Skin="Telerik" EnableViewState="false">  
            <MasterTableView AutoGenerateColumns="False" DataSourceID="dsStructure" DataKeyNames="ROLL_NO">  
                <RowIndicatorColumn> 
                    <HeaderStyle Width="20px" /> 
                </RowIndicatorColumn> 
                <ExpandCollapseColumn> 
                    <HeaderStyle Width="20px" /> 
                </ExpandCollapseColumn> 
                <Columns> 
                    <telerik:GridTemplateColumn UniqueName="TemplateColumn1" HeaderText="Construction">  
                        <ItemTemplate> 
                            CHAR OF CONST:<asp:Label ID="Label58" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.CHAR_OF_CONST") %>'>  
                            </asp:Label><br /> 
                            QUALITY:<asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.QUALITY") %>'>  
                            </asp:Label><br /> 
                            SHAPE:<asp:Label ID="Label2" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.SHAPE") %>'>  
                            </asp:Label><br /> 
                            YEAR BUILT:<asp:Label ID="Label3" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.YEAR_BUILT") %>'>  
                            </asp:Label><br /> 
                            YEAR BUILT CODE:<asp:Label ID="Label4" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.YEAR_BUILT_CODE") %>'>  
                            </asp:Label></ItemTemplate>  
                    </telerik:GridTemplateColumn> 
                    <telerik:GridTemplateColumn UniqueName="TemplateColumn2" HeaderText="Building">  
                        <ItemTemplate> 
                            CONDITION:<asp:Label ID="Label59" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.CONDITION") %>'>  
                            </asp:Label><br /> 
                            FULL STORYS:<asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.FULL_STOREYS") %>'>  
                            </asp:Label><br /> 
                            PART STORYS:<asp:Label ID="Label2" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.PART_STOREYS") %>'>  
                            </asp:Label><br /> 
                            HEIGHT EFF DATE:<asp:Label ID="Label3" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.HEIGHT_EFF_DATE_S") %>'>  
                            </asp:Label><br /> 
                            SPLIT:<asp:Label ID="Label4" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.SPLIT") %>'>  
                            </asp:Label></ItemTemplate>  
                    </telerik:GridTemplateColumn> 
                    <telerik:GridTemplateColumn UniqueName="TemplateColumn3" HeaderText="Area">  
                        <ItemTemplate> 
                            GROSS AREA:<asp:Label ID="Label59" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.GROSS_AREA") %>'>  
                            </asp:Label><br /> 
                            TOTAL BASEMENT:<asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.TOTAL_BASEMENT") %>'>  
                            </asp:Label><br /> 
                            FINISH BASEMENT:<asp:Label ID="Label2" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.FINISH_BASEMENT") %>'>  
                            </asp:Label><br /> 
                            FINISH BASEMENT:<asp:Label ID="Label3" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.FINISH_BASEMENT_TY") %>'>  
                            </asp:Label><br /> 
                            </ItemTemplate> 
                    </telerik:GridTemplateColumn> 
                    <telerik:GridTemplateColumn UniqueName="TemplateColumn4" HeaderText="Features">  
                        <ItemTemplate> 
                            FULL BATHS:<asp:Label ID="Label59" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.FULL_BATHS") %>'>  
                            </asp:Label><br /> 
                            HALF BATHS:<asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.HALF_BATHS") %>'>  
                            </asp:Label><br /> 
                            # BEDROOMS:<asp:Label ID="Label2" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.NO_OF_BEDROOMS") %>'>  
                            </asp:Label><br /> 
                            # FIREPLACES:<asp:Label ID="Label3" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.NO_OF_FIREPLACES") %>'>  
                            </asp:Label><br /> 
                            HEATING TYPE:<asp:Label ID="Label5" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.HEATING_TYPE") %>'>  
                            </asp:Label><br /> 
                            AIR CONDITIONING:<asp:Label ID="Label6" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.AIR_CONDITIONING") %>'>  
                            </asp:Label><br /> 
                           </ItemTemplate> 
                    </telerik:GridTemplateColumn> 
                    <telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="Garage">  
                        <ItemTemplate> 
                            GARAGE TYPE:<asp:Label ID="Label59" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.GARAGE_TYPE") %>'>  
                            </asp:Label><br /> 
                            GARAGE SPACES:<asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.GARAGE_SPACES") %>'>  
                            </asp:Label><br /> 
                            STRUCTURE CODE:<asp:Label ID="Label2" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.STRUCT_CODE") %>'>  
                            </asp:Label></ItemTemplate>  
                    </telerik:GridTemplateColumn> 
                </Columns> 
            </MasterTableView> 
            <FilterMenu EnableTheming="True">  
                <CollapseAnimation Duration="200" Type="OutQuint" /> 
            </FilterMenu> 
        </telerik:RadGrid><asp:ImageButton ID="imgPrint" runat="server" ImageUrl="lib/img/printer.png" 
            ImageAlign="Middle" CausesValidation="False" CssClass="imgPrint" /><asp:LinkButton  
                ID="lnkPrint" runat="server" CssClass="lnkPrint">Print Now</asp:LinkButton> 
        <asp:SqlDataSource ID="dsStructure" runat="server" ConnectionString="<%$ ConnectionStrings:csProperty %>" 
            SelectCommand="SELECT [ROLL_NO], [CHAR_OF_CONST], [QUALITY], [SHAPE], [YEAR_BUILT], [YEAR_BUILT_CODE], [CONDITION], [FULL_STOREYS], [PART_STOREYS], [HEIGHT_EFF_DATE_S], [SPLIT], [GROSS_AREA], [TOTAL_BASEMENT], [FINISH_BASEMENT], [FINISH_BASEMENT_TY], [FULL_BATHS], [HALF_BATHS], [NO_OF_BEDROOMS], [NO_OF_FIREPLACES], [HEATING_TYPE], [AIR_CONDITIONING], [GARAGE_TYPE], [GARAGE_SPACES], [STRUCT_CODE] FROM [TX_STRUCT] WHERE ([ROLL_NO] = @ROLL_NO) ORDER BY [CHAR_OF_CONST] DESC">  
            <SelectParameters> 
                <asp:ControlParameter ControlID="RadGrid1" Name="ROLL_NO" PropertyName="SelectedValue" 
                    Type="string" /> 
            </SelectParameters> 
        </asp:SqlDataSource> 
    </asp:Panel> 
</asp:Content> 
 

1 Answer, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 05 Sep 2008, 11:18 AM
Hello bslaght,

Unfortunately from the information/code snippets provided so far I am not able to determine the exact reason for the issue you are currently facing. Can you please confirm that you are using the latest release 2008.2.826 of RadControls for ASP.NET AJAX (Q2 2008 SP1) in your project?

Note that I tested a case similar to this online demo and the client selection was persisted as expected. Keep in mind that you need to have the viewstate enabled for your selectable grid in order to persist the client selection across postback/ajax requests.

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Brett
Top achievements
Rank 2
Answers by
Sebastian
Telerik team
Share this question
or