troubleshooting Question

Radgrid displays data only after the first postback ...

Avatar of ASkEPA
ASkEPAFlag for Poland asked on
.NET Programming
16 Comments1 Solution6596 ViewsLast Modified:
Hello. I have the following issue, the data in the grid are displayed correctly but after the first refresh the page. How to make that data were displayed in the grid as soon as the page loads?

<%@ Page Language="VB" AutoEventWireup="true" CodeFile="raport_urlopy.aspx.vb" Inherits="raport_urlopy" %>  
  
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>  
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  
<html xmlns="http://www.w3.org/1999/xhtml">   
<head runat="server">   
    <title>Intranet</title>  
</head>  
<body>  
    <form id="form1" runat="server">   
       
    <div class="gora"><a href="default.aspx"><img src="gfx/intranet2.gif" alt="Intranet" border="0"></a>  
    </div>  
       
    <div class="menu">   
   <!-- #include file="inc-menu.aspx "-->       
         
    </div>  
       
    <div class="srodek">   
       
      
    <asp:ScriptManager ID="ScriptManager1" runat="server">   
    </asp:ScriptManager>  
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">   
        </telerik:RadAjaxManager>  
       
       <div style="text-align:left">   
       <div class="pasek">Raport o urlopach</div>  
       <table border="0">   
       <tr>  
       <td align="right" valign="middle">Rok:</td><td align="left" valign="middle">   
          
         <asp:DropDownList ID="ddl_rok" runat="server" DataSourceID="sql_rok"    
                            DataTextField="kp_rok" DataValueField="kp_rok" Width="258px" AutoPostBack="True">   
         </asp:DropDownList>  
          
       </td>  
       </tr>  
          
       <tr>  
       <td align="right" valign="middle">DziaB:</td><td align="left" valign="middle">   
                        <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="sql_dzial"    
                            DataTextField="nazdz" DataValueField="id" Width="258px" AutoPostBack="True"></asp:DropDownList></td>   
       </tr>  
                 
       </table>  
          
    </div>  
          
            <asp:TextBox ID="txt_idp" runat="server" Visible="False"></asp:TextBox>  
          
        <br />       
        
        <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="sql_urlopy_glowne"    
            GridLines="None" AllowSorting="True" ShowGroupPanel="True" Skin="Hay" allow>  
         
            <MasterTableView AutoGenerateColumns="False" DataKeyNames="idp" DataSourceID="sql_urlopy_glowne">   
                <DetailTables>  
                    <telerik:GridTableView AutoGenerateColumns="false" DataKeyNames="idp" DataSourceID="sql_urlopy_pomoc" Width="100%" runat="server">   
                                             
                        <ParentTableRelation>  
                            <telerik:GridRelationFields DetailKeyField="idp" MasterKeyField="idp" />  
                        </ParentTableRelation>  
                        <Columns>  
                            <telerik:GridBoundColumn SortExpression="opis" HeaderText="Typ" DataField="opis" UniqueName="opis">   
                            </telerik:GridBoundColumn>  
                               
                             <telerik:GridBoundColumn SortExpression="pdn" HeaderText="Od" DataField="pdn" UniqueName="pdn"  DataFormatString="{0:dd-MM-yyyy}">   
                            </telerik:GridBoundColumn>  
                               
                              <telerik:GridBoundColumn SortExpression="odn" HeaderText="Do" DataField="odn" UniqueName="odn"  DataFormatString="{0:dd-MM-yyyy}">   
                            </telerik:GridBoundColumn>  
                        </Columns>  
                                      
                    </telerik:GridTableView>  
                </DetailTables>  
  
<ExpandCollapseColumn Visible="True"></ExpandCollapseColumn>  
  
                <Columns>  
                    <telerik:GridBoundColumn DataField="idp" DataType="System.Int32" HeaderText="idp"  
                        ReadOnly="True" SortExpression="idp" UniqueName="idp" Visible="false">   
                    </telerik:GridBoundColumn>  
                    <telerik:GridBoundColumn DataField="naz" HeaderText="Nazwisko" SortExpression="naz" UniqueName="naz">   
                    </telerik:GridBoundColumn>  
                    <telerik:GridBoundColumn DataField="IL_UrlopWymiar" DataType="System.Int16" HeaderText="Wymiar"  
                        SortExpression="IL_UrlopWymiar" UniqueName="IL_UrlopWymiar">   
                    </telerik:GridBoundColumn>  
                      
                    <telerik:GridBoundColumn DataField="KD_IL_UrlopPrzysl" DataType="System.Int16" HeaderText="PrzysBugujcy"  
                        SortExpression="KD_IL_UrlopPrzysl" UniqueName="KD_IL_UrlopPrzysl">   
                    </telerik:GridBoundColumn>  
                       
                     <telerik:GridBoundColumn DataField="IL_UrlopDoWyk" DataType="System.Int16" HeaderText="PozostaBy"  
                        SortExpression="IL_UrlopDoWyk" UniqueName="IL_UrlopDoWyk">   
                    </telerik:GridBoundColumn>  
                </Columns>  
            </MasterTableView>  
            <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True"    
                ReorderColumnsOnClient="True">   
                <Selecting AllowRowSelect="True" />  
            </ClientSettings>  
        </telerik:RadGrid>  
                             
        <br /><br /><br />  
                      
    </div>  
       
       
    <asp:SqlDataSource ID="sql_dzial" runat="server"    
        ConnectionString="<%$ ConnectionStrings:Polaczenie-Portal %>"    
        SelectCommand="proc_wczytaj_dzialy" SelectCommandType="StoredProcedure">   
      
       <SelectParameters>  
        
           <asp:FormParameter DefaultValue="122" FormField="txt_idp" Name="idpracownika"    
               Type="Int32" />  
        
        
       </SelectParameters>         
               
     </asp:SqlDataSource>  
      
    <asp:SqlDataSource ID="sql_urlopy_glowne" runat="server"    
        ConnectionString="<%$ ConnectionStrings:Polaczenie-Portal %>"    
        SelectCommand="proc_pokaz_ilosc_urlopow_w_dziale"    
        SelectCommandType="StoredProcedure">   
           
        <SelectParameters>  
         
            <asp:ControlParameter ControlID="DropDownList1" Name="id_dzial"    
                PropertyName="SelectedValue" Type="Int32" />  
           
             <asp:ControlParameter ControlID="ddl_rok" Name="rok"    
                PropertyName="SelectedValue" Type="Int32" />     
           
            <asp:SessionParameter Name="idpracownika" SessionField="idpracownika" Type="string" />                                         
           
        </SelectParameters>  
           
    </asp:SqlDataSource>  
    
    <asp:SqlDataSource ID="sql_urlopy_pomoc" ConnectionString="<%$ ConnectionStrings:Polaczenie-Portal %>"  
        ProviderName="System.Data.SqlClient" SelectCommand="select pracownik as idp, opis, pdn, odn from poza_biurem join urlopy on poza_biurem.id = urlopy.id_poza_biurem where pracownik = @idp and aktywny=1"  
        runat="server">   
        <SelectParameters>  
            <asp:SessionParameter Name="idp" SessionField="idp" Type="string" />  
        </SelectParameters>  
        </asp:SqlDataSource>  
           
        <asp:SqlDataSource ID="sql_rok" ConnectionString="<%$ ConnectionStrings:Polaczenie-Portal %>"  
            ProviderName="System.Data.SqlClient" SelectCommand="select distinct kp_rok from kd_urlopy2" SelectCommandType="Text"  
            runat="server"></asp:SqlDataSource>  
      
       
    </form>  
</body>  
</html>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 16 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 16 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros