Row Disappears on PostBack

2 posts, 0 answers
  1. bslaght
    bslaght avatar
    184 posts
    Member since:
    Jun 2006

    Posted 02 Sep 2008 Link to this post

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

    1 <%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" 
    2     CodeFile="byRoll.aspx.vb" Inherits="byRoll" %> 
    3  
    4 <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> 
    5 <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
    6 <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">  
    7     <style type="text/css">  
    8         .style1  
    9         {  
    10             font-size: xx-small;  
    11             font-style: italic;  
    12         }  
    13     </style> 
    14 </asp:Content> 
    15 <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">  
    16     <div id="searchblock">  
    17         <cc1:TextBoxWatermarkExtender ID="tbwm1" runat="server" TargetControlID="txtSearch" 
    18             WatermarkText="401015084000000" WatermarkCssClass="txtWatermark">  
    19         </cc1:TextBoxWatermarkExtender> 
    20         <asp:TextBox ID="txtSearch" runat="server"></asp:TextBox> 
    21         <asp:Button ID="btnSearch" runat="server" Text="Search" /> 
    22         <telerik:RadToolTip ID="RadToolTip1" runat="server" Animation="Fade" AutoCloseDelay="5000" 
    23             ShowDelay="100" Skin="Hay" TargetControlID="txtSearch" Text="Please enter one complete Roll No." 
    24             VisibleOnPageLoad="False">  
    25         </telerik:RadToolTip> 
    26     </div> 
    27     <p> 
    28         <asp:Label ID="lblError" runat="server" ForeColor="#FF3300"></asp:Label> 
    29     </p> 
    30     <asp:Panel ID="pnlDetails" runat="server" Visible="False">  
    31         <div class="tablehdr">  
    32             <h3> 
    33                 Municipal Property Details</h3> 
    34              <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="dsGrid" Skin="Telerik" 
    35         GridLines="None" AllowPaging="True" PageSize="5">  
    36         <MasterTableView AutoGenerateColumns="False" DataSourceID="dsGrid" DataKeyNames="ROLL_NO">  
    37             <RowIndicatorColumn> 
    38                 <HeaderStyle Width="20px"></HeaderStyle> 
    39             </RowIndicatorColumn> 
    40             <ExpandCollapseColumn> 
    41                 <HeaderStyle Width="20px"></HeaderStyle> 
    42             </ExpandCollapseColumn> 
    43             <Columns> 
    44                 <telerik:GridBoundColumn DataField="ROLL_NO" HeaderText="Roll Number" SortExpression="ROLL_NO" 
    45                     UniqueName="ROLL_NO">  
    46                 </telerik:GridBoundColumn> 
    47                      <telerik:GridTemplateColumn HeaderText="Address" UniqueName="TemplateColumn">  
    48                     <ItemTemplate> 
    49                         <asp:Label ID="lblStNum" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.STREET_NO") %>'>  
    50                         </asp:Label>&nbsp;<asp:Label ID="lblStName" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.STREET_NAME") %>'>  
    51                         </asp:Label> 
    52                     </ItemTemplate> 
    53                 </telerik:GridTemplateColumn> 
    54                   
    55                 <telerik:GridTemplateColumn HeaderText="Legal Description" UniqueName="TemplateColumn">  
    56                     <ItemTemplate> 
    57                         <asp:Label ID="Label58" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.LEGAL1") %>'>  
    58                         </asp:Label><br /> 
    59                         <asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.LEGAL2") %>'>  
    60                         </asp:Label><br /> 
    61                         <asp:Label ID="Label2" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.LEGAL3") %>'>  
    62                         </asp:Label><br /> 
    63                         <asp:Label ID="Label3" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.LEGAL4") %>'>  
    64                         </asp:Label><br /> 
    65                         <asp:Label ID="Label4" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.LEGAL5") %>'>  
    66                         </asp:Label> 
    67                     </ItemTemplate> 
    68                 </telerik:GridTemplateColumn> 
    69                 <telerik:GridBoundColumn DataField="CLASS" HeaderText="Class" SortExpression="CLASS" 
    70                     UniqueName="CLASS">  
    71                 </telerik:GridBoundColumn> 
    72                 <telerik:GridBoundColumn DataField="ASSESSMENT" DataType="System.Decimal" HeaderText="Assesed Value" 
    73                     SortExpression="ASSESSMENT" UniqueName="ASSESSMENT" DataFormatString="{0:c}">  
    74                 </telerik:GridBoundColumn> 
    75              <%--   <telerik:GridHyperLinkColumn HeaderText="More Details" NavigateUrl="details.aspx?txtSearch={0}" 
    76                     Text="View Details" UniqueName="column" DataNavigateUrlFields="ROLL_NO">  
    77                     <HeaderStyle HorizontalAlign="Center" /> 
    78                     <ItemStyle HorizontalAlign="Center" /> 
    79                 </telerik:GridHyperLinkColumn>--%> 
    80             </Columns> 
    81         </MasterTableView> 
    82         <ClientSettings EnablePostBackOnRowClick="True">  
    83             <Selecting AllowRowSelect="True" /> 
    84         </ClientSettings> 
    85         <FilterMenu EnableTheming="True">  
    86             <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
    87         </FilterMenu> 
    88     </telerik:RadGrid> 
    89   <asp:SqlDataSource ID="dsGrid" runat="server" ConnectionString="<%$ ConnectionStrings:csProperty %>" 
    90         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  
    91 FROM TX_ROLL txroll LEFT OUTER JOIN TX_ROLL_ASSESS_SAS ON txroll.ROLL_NO = TX_ROLL_ASSESS_SAS.ROLL_NO    
    92 WHERE txroll.ROLL_NO = @ROLL_NO"> 
    93         <SelectParameters> 
    94             <asp:ControlParameter Name="ROLL_NO" ControlID="txtSearch" Type="String" /> 
    95         </SelectParameters> 
    96     </asp:SqlDataSource> 
    97         </div> 
    98     </asp:Panel> 
    99       
    100     <asp:Panel ID="pnlStructure" runat="server" Visible="False">  
    101      <div class="tablehdr">  
    102             <h3> 
    103                 Sturcture Details</h3> 
    104             <span class="style1">The information contained in this area of this web site   
    105             should be reviewed with caution as the details provided may not be up-to-date.</span></div>  
    106         <telerik:RadGrid ID="RadGrid2" runat="server" DataSourceID="dsStructure" GridLines="None" 
    107             Skin="Telerik" EnableViewState="false">  
    108             <MasterTableView AutoGenerateColumns="False" DataSourceID="dsStructure" DataKeyNames="ROLL_NO">  
    109                 <RowIndicatorColumn> 
    110                     <HeaderStyle Width="20px" /> 
    111                 </RowIndicatorColumn> 
    112                 <ExpandCollapseColumn> 
    113                     <HeaderStyle Width="20px" /> 
    114                 </ExpandCollapseColumn> 
    115                 <Columns> 
    116                     <telerik:GridTemplateColumn UniqueName="TemplateColumn1" HeaderText="Construction">  
    117                         <ItemTemplate> 
    118                             CHAR OF CONST:<asp:Label ID="Label58" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.CHAR_OF_CONST") %>'>  
    119                             </asp:Label><br /> 
    120                             QUALITY:<asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.QUALITY") %>'>  
    121                             </asp:Label><br /> 
    122                             SHAPE:<asp:Label ID="Label2" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.SHAPE") %>'>  
    123                             </asp:Label><br /> 
    124                             YEAR BUILT:<asp:Label ID="Label3" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.YEAR_BUILT") %>'>  
    125                             </asp:Label><br /> 
    126                             YEAR BUILT CODE:<asp:Label ID="Label4" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.YEAR_BUILT_CODE") %>'>  
    127                             </asp:Label></ItemTemplate>  
    128                     </telerik:GridTemplateColumn> 
    129                     <telerik:GridTemplateColumn UniqueName="TemplateColumn2" HeaderText="Building">  
    130                         <ItemTemplate> 
    131                             CONDITION:<asp:Label ID="Label59" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.CONDITION") %>'>  
    132                             </asp:Label><br /> 
    133                             FULL STORYS:<asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.FULL_STOREYS") %>'>  
    134                             </asp:Label><br /> 
    135                             PART STORYS:<asp:Label ID="Label2" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.PART_STOREYS") %>'>  
    136                             </asp:Label><br /> 
    137                             HEIGHT EFF DATE:<asp:Label ID="Label3" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.HEIGHT_EFF_DATE_S") %>'>  
    138                             </asp:Label><br /> 
    139                             SPLIT:<asp:Label ID="Label4" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.SPLIT") %>'>  
    140                             </asp:Label></ItemTemplate>  
    141                     </telerik:GridTemplateColumn> 
    142                     <telerik:GridTemplateColumn UniqueName="TemplateColumn3" HeaderText="Area">  
    143                         <ItemTemplate> 
    144                             GROSS AREA:<asp:Label ID="Label59" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.GROSS_AREA") %>'>  
    145                             </asp:Label><br /> 
    146                             TOTAL BASEMENT:<asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.TOTAL_BASEMENT") %>'>  
    147                             </asp:Label><br /> 
    148                             FINISH BASEMENT:<asp:Label ID="Label2" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.FINISH_BASEMENT") %>'>  
    149                             </asp:Label><br /> 
    150                             FINISH BASEMENT:<asp:Label ID="Label3" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.FINISH_BASEMENT_TY") %>'>  
    151                             </asp:Label><br /> 
    152                             </ItemTemplate> 
    153                     </telerik:GridTemplateColumn> 
    154                     <telerik:GridTemplateColumn UniqueName="TemplateColumn4" HeaderText="Features">  
    155                         <ItemTemplate> 
    156                             FULL BATHS:<asp:Label ID="Label59" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.FULL_BATHS") %>'>  
    157                             </asp:Label><br /> 
    158                             HALF BATHS:<asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.HALF_BATHS") %>'>  
    159                             </asp:Label><br /> 
    160                             # BEDROOMS:<asp:Label ID="Label2" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.NO_OF_BEDROOMS") %>'>  
    161                             </asp:Label><br /> 
    162                             # FIREPLACES:<asp:Label ID="Label3" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.NO_OF_FIREPLACES") %>'>  
    163                             </asp:Label><br /> 
    164                             HEATING TYPE:<asp:Label ID="Label5" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.HEATING_TYPE") %>'>  
    165                             </asp:Label><br /> 
    166                             AIR CONDITIONING:<asp:Label ID="Label6" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.AIR_CONDITIONING") %>'>  
    167                             </asp:Label><br /> 
    168                            </ItemTemplate> 
    169                     </telerik:GridTemplateColumn> 
    170                     <telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="Garage">  
    171                         <ItemTemplate> 
    172                             GARAGE TYPE:<asp:Label ID="Label59" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.GARAGE_TYPE") %>'>  
    173                             </asp:Label><br /> 
    174                             GARAGE SPACES:<asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.GARAGE_SPACES") %>'>  
    175                             </asp:Label><br /> 
    176                             STRUCTURE CODE:<asp:Label ID="Label2" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.STRUCT_CODE") %>'>  
    177                             </asp:Label></ItemTemplate>  
    178                     </telerik:GridTemplateColumn> 
    179                 </Columns> 
    180             </MasterTableView> 
    181             <FilterMenu EnableTheming="True">  
    182                 <CollapseAnimation Duration="200" Type="OutQuint" /> 
    183             </FilterMenu> 
    184         </telerik:RadGrid><asp:ImageButton ID="imgPrint" runat="server" ImageUrl="lib/img/printer.png" 
    185             ImageAlign="Middle" CausesValidation="False" CssClass="imgPrint" /><asp:LinkButton  
    186                 ID="lnkPrint" runat="server" CssClass="lnkPrint">Print Now</asp:LinkButton> 
    187         <asp:SqlDataSource ID="dsStructure" runat="server" ConnectionString="<%$ ConnectionStrings:csProperty %>" 
    188             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">  
    189             <SelectParameters> 
    190                 <asp:ControlParameter ControlID="RadGrid1" Name="ROLL_NO" PropertyName="SelectedValue" 
    191                     Type="string" /> 
    192             </SelectParameters> 
    193         </asp:SqlDataSource> 
    194     </asp:Panel> 
    195 </asp:Content> 
    196  
  2. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 05 Sep 2008 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top