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

Loding with User control

3 Answers 16 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Prabha
Top achievements
Rank 1
Prabha asked on 18 Aug 2014, 06:46 AM
Hi All,

i have designed my webpage with a raddropdowntree and a RadComboBox . when im clicking on that raddropdowntree , 'EntryAdded' event will fire and a RadComboBox will load. In this event , the page will be blinking. So that i have trying to avoid that. if i will use RadAjaxManager means, the RadDropDownTree  canot be load and accessible. Anybody tell me the solution that, how to avoid flickering  using Rad in webpage while postback. below is the sample code.
<rad:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
       <rad:AjaxSetting AjaxControlID="rddtArea">
            <UpdatedControls>
                <rad:AjaxUpdatedControl ControlID="rcmbName">
            </UpdatedControls>
        </rad:AjaxSetting>
    </AjaxSettings>
</rad:RadAjaxManager>
<rad:RadSplitter runat="server" ID="RadSplitter1" Width="100%" BorderSize="0" BorderStyle="None"
    PanesBorderSize="0" Height="100" Orientation="Horizontal">
    <rad:RadPane ID="RadPane1" runat="server" Height="100%">
   <rad:RadDropDownTree ID="rddtArea" runat="server" DropDownSettings-CloseDropDownOnSelection="true"
                        OnEntryAdded="rddtArea_EntryAdded" EnableFiltering="true" FilterSettings-Highlight="Matches"
                        Skin="Outlook" DropDownSettings-Height="100" AutoPostBack="true">
                    </rad:RadDropDownTree>
  <rad:RadComboBox ID="rcmbworkflowtemplate" runat="server" DataValueField="MOCID"
                        AppendDataBoundItems="false" DataTextField="MOCTitle" AutoPostBack="true" OnSelectedIndexChanged="rcmbworkflowtemplate_SelectedIndexChanged">
                  </rad:RadComboBox>
  </rad:RadPane>
</rad:RadSplitter>












3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 18 Aug 2014, 09:05 AM
Hi Prabha,

Please have a look into the sample code snippet which works fine at my end.

ASPX:
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">
</telerik:RadAjaxLoadingPanel>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="rdroptreeEmployees">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="rcboListItems" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadDropDownTree ID="rdroptreeEmployees" runat="server" DataFieldID="EmployeeID" DataValueField="EmployeeID" AutoPostBack="true" DataFieldParentID="ReportsTo" DataTextField="LastName" DataSourceID="sqldsEmployees" OnEntryAdded="rdroptreeEmployees_EntryAdded">
</telerik:RadDropDownTree>
<telerik:RadComboBox ID="rcboListItems" runat="server">
</telerik:RadComboBox>

C#:
protected void rdroptreeEmployees_EntryAdded(object sender, Telerik.Web.UI.DropDownTreeEntryEventArgs e)
{
    String connectionstring = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
    SqlConnection sqlconn = new SqlConnection(connectionstring);
    SqlDataAdapter adapter = new SqlDataAdapter();
    adapter.SelectCommand = new SqlCommand("SELECT * from EmployeeTerritories where EmployeeID='"+e.Entry.Value+"' ", sqlconn);
    DataTable data = new DataTable();
    sqlconn.Open();
    try
    {
        adapter.Fill(data);
    }
    finally
    {
        sqlconn.Close();
    }
    rcboListItems.DataSource = data;
    rcboListItems.DataTextField = "TerritoryID";
    rcboListItems.DataValueField = "EmployeeID";
    rcboListItems.DataBind();
}

Thanks,
Princy.
0
Prabha
Top achievements
Rank 1
answered on 18 Aug 2014, 11:06 AM
hi Princy,

I have tried your code, but its not working in my end. Actually the Raddropdowntree should be load at Page_load itself. if i will use telerik:RadAjaxManager  means, Raddropdowntree  itself doesnot load at Page_load . (these controls are inside asp:Content, and it refer master page also. )
0
Princy
Top achievements
Rank 1
answered on 19 Aug 2014, 02:55 AM
Hi Prabha,

Such an issue is not expected. Try to add RadAjaxManager in the Master Page and RadAjaxManagerProxy in the content page. Please have a look into the sample code snippet which works fine at my end.

MasterPage :
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">
</telerik:RadAjaxLoadingPanel>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
</telerik:RadAjaxManager>

ContentPage:
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <telerik:RadAjaxManagerProxy ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="rdroptreeEmployees">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rcboListItems" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>
    <telerik:RadDropDownTree ID="rdroptreeEmployees" runat="server" AutoPostBack="true"
        OnEntryAdded="rdroptreeEmployees_EntryAdded">
    </telerik:RadDropDownTree>
    <telerik:RadComboBox ID="rcboListItems" runat="server">
    </telerik:RadComboBox>
    <asp:SqlDataSource ID="sqldsEmployees" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [EmployeeID], [ReportsTo], [LastName] FROM [Employees]">
    </asp:SqlDataSource>
</asp:Content>

Content Page C#:
protected void Page_Load(object sender, EventArgs e)
{
    rdroptreeEmployees.DataSourceID = "sqldsEmployees";
    rdroptreeEmployees.DataFieldID = "EmployeeID";
    rdroptreeEmployees.DataFieldParentID = "ReportsTo";
    rdroptreeEmployees.DataTextField = "LastName";
    rdroptreeEmployees.DataValueField = "EmployeeID";
    rdroptreeEmployees.DataBind();
}
protected void rdroptreeEmployees_EntryAdded(object sender, Telerik.Web.UI.DropDownTreeEntryEventArgs e)
{
    String connectionstring = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
    SqlConnection sqlconn = new SqlConnection(connectionstring);
    SqlDataAdapter adapter = new SqlDataAdapter();
    adapter.SelectCommand = new SqlCommand("SELECT * from EmployeeTerritories where EmployeeID='" + e.Entry.Value + "' ", sqlconn);
    DataTable data = new DataTable();
    sqlconn.Open();
    try
    {
        adapter.Fill(data);
    }
    finally
    {
        sqlconn.Close();
    }
    rcboListItems.DataSource = data;
    rcboListItems.DataTextField = "TerritoryID";
    rcboListItems.DataValueField = "EmployeeID";
    rcboListItems.DataBind();
}

Thanks,
Princy.
Tags
Ajax
Asked by
Prabha
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Prabha
Top achievements
Rank 1
Share this question
or