InitialPageLoad

2 posts, 0 answers
  1. Kjell
    Kjell avatar
    223 posts
    Member since:
    May 2011

    Posted 27 Nov 2012 Link to this post

    Have problem to load my TreeView using "Public Sub buildTree()" and InitialPageLoad...
    What can I possibly do wrong ....

        <telerik:RadAjaxManager ID="RadAjaxManager1" OnAjaxRequest="RadAjaxManager1_AjaxRequest" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="PanelLoad" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
            <ClientEvents OnRequestStart="RequestStart" OnResponseEnd="ResponseEnd" />
        </telerik:RadAjaxManager>
     
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript">
                function RequestStart(sender, eventArgs) {
                    $get("<%=modalDiv.ClientID %>").style.display = "block";
                }
     
                function ResponseEnd(sender, eventArgs) {
                    $get("<%=modalDiv.ClientID %>").style.display = "none";
                }
     
                function pageLoad(sender, eventArgs) {
                    if (!eventArgs.get_isPartialLoad()) {
                        $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("InitialPageLoad");
                    }
                }
            </script>
        </telerik:RadCodeBlock>
     
    <asp:Panel ID="PanelLoad" Visible="False" Style="padding-left: 6px; padding-top:6px;" runat="server">
    My TreeView databind using the "Public Sub buildTree()"
    </asp:Panel>
     
        <div id="modalDiv" style="position: absolute; top: 40px; left: 0px; height: 3000px; width: 100%; z-index: 100; background: gray; display: none; opacity: 0.3; filter: alpha(opacity=100);" runat="server" />
    Protected
    Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs)
        If e.Argument = "InitialPageLoad" Then
            'System.Threading.Thread.Sleep(3000)
            PanelLoad.Visible = True
        End If
    End Sub
     
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            buildTree()
        End If
    End Sub
     
    '....................................
     
    Public Sub buildTree()
     
        Dim MyConnection As New SqlConnection(System.Configuration..................
        Dim MyDataAdapter As New SqlDataAdapter("select NodeId, ParentNodeId................
     
        Dim DS As New DataSet()
        MyDataAdapter.Fill(DS)
     
        DS.Relations.Add("NodeRelation",...........
  2. Marin
    Admin
    Marin avatar
    1057 posts

    Posted 30 Nov 2012 Link to this post

    Hi,

     You should make sure that the buildTree() function is executed when you perform an ajax request. You may need to revise the current condition in the Page_Load event (If Not Page.IsPostBack Then
    ) which will be false in the case of an ajax request and the procedure will not be executed at all.

    Kind regards,
    Marin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top