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

InitialPageLoad

1 Answer 81 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Kjell
Top achievements
Rank 1
Iron
Kjell asked on 27 Nov 2012, 12:45 PM
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",...........

1 Answer, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 30 Nov 2012, 09:15 AM
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.
Tags
Ajax
Asked by
Kjell
Top achievements
Rank 1
Iron
Answers by
Marin
Telerik team
Share this question
or