Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
164 views
Hi,

I have tried to implement a load-on-demand scenario as per this demo, but have run into problems. When I first load the page, the first tab is populated properly. If I then click on the 2nd tab and then click back to the first one, the first tab is blank.

Here is my code:
CustomerDetails.aspx
    <script type="text/javascript">
 
        function onTabSelecting(sender, args) {
            if (args.get_tab().get_pageViewID()) {
                args.get_tab().set_postBack(false);
            }
        }
         
    </script>
 
<h1>Customer Details</h1>
 
<div class="normalPanel"><asp:Label ID="CustomerIdLabel" runat="server" Text="Customer ID: " /></div>
 
<telerik:RadTabStrip ID="CustomerDetailsRadTabStrip" ClientIDMode="Static" ShowBaseLine="true"
                     OnClientTabSelecting="onTabSelecting" runat="server" MultiPageID="CustomerDetailsRadMultiPage"
                     OnTabClick="RadTabStrip1_TabClick" Orientation="HorizontalTop">
</telerik:RadTabStrip>
 
<telerik:RadMultiPage ID="CustomerDetailsRadMultiPage" ClientIDMode="Static" runat="server" SelectedIndex="0"
                      OnPageViewCreated="RadMultiPage1_PageViewCreated">
</telerik:RadMultiPage>

CustomerDetails.aspx.cs
using System;
using Microsoft.Practices.ObjectBuilder;
using System.Collections;
using AWModel;
using System.Data.Objects;
using Telerik.Web.UI;
using System.Web.UI;
using AdvWorksWCSF.Shared.Code;
 
namespace AdvWorksWCSF.Customer.Views
{
    public partial class CustomerDetails : Microsoft.Practices.CompositeWeb.Web.UI.Page, ICustomerDetailsView
    {
        private CustomerDetailsPresenter _presenter;
        private ViewStateValue<int> customerID;
 
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                this._presenter.OnViewInitialized();
 
                this.AddTab("Customer Details", "CustomerDetailsControl");
                this.AddPageView(this.CustomerDetailsRadTabStrip.FindTabByValue("CustomerDetailsControl"));
                this.AddTab("Demographics", "DemographicInfoControl");
 
                CustomerDetailsControl customerDetailsControl = this.CustomerDetailsRadMultiPage.FindControl("CustomerDetailsControl_userControl") as CustomerDetailsControl;
                customerDetailsControl.CustomerID = int.Parse(Request.QueryString["CustomerID"]);
                this.CustomerIdLabel.Text += customerDetailsControl.CustomerID.ToString();
            }
            this._presenter.OnViewLoaded();
        }
 
        [CreateNew]
        public CustomerDetailsPresenter Presenter
        {
            get
            {
                return this._presenter;
            }
            set
            {
                if (value == null)
                    throw new ArgumentNullException("value");
 
                this._presenter = value;
                this._presenter.View = this;
            }
        }
 
        private void AddTab(string tabName, string tabValue)
        {
            RadTab tab = new RadTab();
            tab.Text = tabName;
            tab.Value = tabValue;
            this.CustomerDetailsRadTabStrip.Tabs.Add(tab);
        }
 
        protected void RadMultiPage1_PageViewCreated(object sender, RadMultiPageEventArgs e)
        {
            string userControlToLoad = this.AppRelativeTemplateSourceDirectory +
                string.Format(Constants.BuildTabString, e.PageView.ID);
 
            Control userControl = Page.LoadControl(userControlToLoad);
            userControl.ID = string.Format(Constants.BuildUserControlString, e.PageView.ID);
 
            e.PageView.Controls.Add(userControl);
        }
 
        private void AddPageView(RadTab tab)
        {
            RadPageView pageView = new RadPageView();
            pageView.ID = tab.Value;
            this.CustomerDetailsRadMultiPage.PageViews.Add(pageView);
            //pageView.CssClass = "pageView";
            tab.PageViewID = pageView.ID;
        }
 
        protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)
        {
            AddPageView(e.Tab);
            e.Tab.PageView.Selected = true;
        }
    }
}

CustomerDetailsControl.ascx
<%@ Control Language="C#" AutoEventWireup="true" Codebehind="CustomerDetailsControl.ascx.cs" Inherits="AdvWorksWCSF.Customer.Views.CustomerDetailsControl" %>
 
<%@ Import Namespace="AWModel" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
    <asp:FormView ID="CustomerDetailsFormView" runat="server" CssClass="customerDetailsForView">
        <ItemTemplate>
        <asp:Panel ID="NameDetailsPanel" runat="server" ClientIDMode="Static" GroupingText="Name and Title" CssClass="normalPanel">
            <div class="customerDetailsRow">
                <div class="customerDetailsLeftCell">
                    <div class="customerDetailsLabel">Title:</div>
                    <div class="customerDetailsValue"><asp:Label ID="TitleLabel" Text='<%# Eval("Title") %>' runat="server" /></div>
                </div>
                <div class="customerDetailsRightCell">
                    <div class="customerDetailsLabel">Last Name:</div>
                    <div class="customerDetailsValue"><asp:Label ID="LastNameLabel" Text='<%# ((GetDetailsForIndividualCustomerCT)Container.DataItem).LastName.ToString() %>' runat="server" /></div>
                </div>
            </div>
            <div class="customerDetailsRow">
                <div class="customerDetailsLeftCell">
                    <div class="customerDetailsLabel">First Name:</div>
                    <div class="customerDetailsValue"><asp:Label ID="FirstNameLabel" Text='<%# ((GetDetailsForIndividualCustomerCT)Container.DataItem).FirstName.ToString() %>' runat="server" /></div>
                </div>
                <div class="customerDetailsRightCell">
                    <div class="customerDetailsLabel">Middle Name:</div>
                    <div class="customerDetailsValue"><asp:Label ID="MiddleNameLabel" Text='<%# Eval("MiddleName") %>' runat="server" /></div>
                </div>
            </div>
        </asp:Panel>
        <asp:Panel ID="ContactDetailsPanel" GroupingText="Contact Details" runat="server" CssClass="normalPanel">
            <div class="customerDetailsRow">
                <div class="customerDetailsLeftCell">
                    <div class="customerDetailsLabel">Email:</div>
                    <div class="customerDetailsValue"><asp:Label ID="EmailLabel" Text='<%# ((GetDetailsForIndividualCustomerCT)Container.DataItem).EmailAddress.ToString() %>' runat="server" /></div>
                </div>
                <div class="customerDetailsRightCell">
                    <div class="customerDetailsLabel">Phone:</div>
                    <div class="customerDetailsValue"><asp:Label ID="PhoneLabel" Text='<%# Eval("Phone") %>' runat="server" /></div>
                </div>
            </div>
            <div class="customerDetailsRow">
                <div class="customerDetailsLeftCell">
                    <div class="customerDetailsLabel">Address:</div>
                    <div class="customerDetailsValue"><asp:Label ID="AddressLine1Label" Text='<%# ((GetDetailsForIndividualCustomerCT)Container.DataItem).AddressLine1.ToString() %>' runat="server" /></div>
                </div>
                <div class="customerDetailsLeftCell">
                    <div class="customerDetailsLabel"></div>
                    <div class="customerDetailsValue"><asp:Label ID="AddressLine2Label" Text='<%# Eval("AddressLine2") %>' runat="server" /></div>
                </div>
            </div>
            <div class="customerDetailsRow">
                <div class="customerDetailsLeftCell">
                    <div class="customerDetailsLabel">City:</div>
                    <div class="customerDetailsValue"><asp:Label ID="CityLabel" Text='<%# ((GetDetailsForIndividualCustomerCT)Container.DataItem).City.ToString() %>' runat="server" /></div>
                </div>
                <div class="customerDetailsRightCell">
                    <div class="customerDetailsLabel">Post code:</div>
                    <div class="customerDetailsValue"><asp:Label ID="PostalCodeLabel" Text='<%# Eval("PostalCode") %>' runat="server" /></div>
                </div>
            </div>
            <div class="customerDetailsRow">
                <div class="customerDetailsLeftCell">
                    <div class="customerDetailsLabel">State/Province:</div>
                    <div class="customerDetailsValue"><asp:Label ID="Label1" Text='<%# ((GetDetailsForIndividualCustomerCT)Container.DataItem).State_Province.ToString() %>' runat="server" /></div>
                </div>
                <div class="customerDetailsRightCell">
                    <div class="customerDetailsLabel">Sales Territory:</div>
                    <div class="customerDetailsValue"><asp:Label ID="Label2" Text='<%# ((GetDetailsForIndividualCustomerCT)Container.DataItem).Sales_Territory.ToString() %>' runat="server" /></div>
                </div>
            </div>
        </asp:Panel>
        </ItemTemplate>
    </asp:FormView>

CustomerDetailsControl.ascx.cs:
using System;
using Microsoft.Practices.ObjectBuilder;
using AWModel;
using System.Data.Objects;
 
namespace AdvWorksWCSF.Customer.Views
{
    public partial class CustomerDetailsControl : Microsoft.Practices.CompositeWeb.Web.UI.UserControl, ICustomerDetailsControlView
    {
        private CustomerDetailsControlPresenter _presenter;
        private int customerID;
 
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                this._presenter.OnViewInitialized();
            }
            this._presenter.OnViewLoaded();
        }
 
        [CreateNew]
        public CustomerDetailsControlPresenter Presenter
        {
            get
            {
                return this._presenter;
            }
            set
            {
                if (value == null)
                    throw new ArgumentNullException("value");
 
                this._presenter = value;
                this._presenter.View = this;
            }
        }
 
        public int CustomerID
        {
            get
            {
                return customerID;
            }
            set
            {
                customerID = value;
            }
        }
 
        public ObjectResult<GetDetailsForIndividualCustomerCT> CustomerDetailsFormDataSource
        {
            set
            {
                this.CustomerDetailsFormView.DataSource = value;
                this.CustomerDetailsFormView.DataBind();
            }
        }
    }
}

There's another interesting thing which happens. If I add a RadAjaxManagerProxy to the aspx page setting the tabstrip as the source and updated controls along with the Multipage as a second updated control (as is done in the demo referred to above, a javascript error (null reference) is thrown.

<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="CustomerDetailsRadTabStrip">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="CustomerDetailsRadTabStrip" />
                <telerik:AjaxUpdatedControl ControlID="CustomerDetailsRadMultiPage" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="CustomerDetailsRadMultiPage">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="CustomerDetailsRadMultiPage" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>

Here is a screenshot of the error.

Can anyone see why there is a problem? What have I done wrong?

Cheers
Kwok (Andrew)
Top achievements
Rank 1
 answered on 06 Nov 2012
1 answer
283 views
hi there,
i have read many blog posts and have tried several different things and am stuck.

I have a Radwindow which contains a YouTube video. When I close the window, the audio continues to play.

I read all the blog posts (http://blogs.telerik.com/blogs/posts/09-06-04/common-radwindow-issues-and-their-solution.aspx) and attempted to perform the same methodology.

Here is my code on the aspx page:

<telerik:RadWindow ID="rwOrgDetails" runat="server" Modal="true"
       Behaviors="Close,Move"
        ShowContentDuringLoad="False" AutoSize="true"
        AutoSizeBehaviors="Default" MinWidth="400px" Animation="FlyIn"
        KeepInScreenBounds="True" VisibleStatusbar="False"
        OnClientShow="re" DestroyOnClose="true" OnClientClose="OnClientClose" EnableViewState="False">
     <ContentTemplate>
        <asb:organization ID="detailedView" runat="server" />
        <div align="center" class="hiddenClose" style="display:none" >
          <telerik:RadButton ID="RadButton6" SkinID="Close" runat="server" OnClientClicking="cw">
            </telerik:RadButton>      
        </div>
     </ContentTemplate>  
    </telerik:RadWindow>

Within the same page I have the following script:

<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
<script type="text/javascript">
 
    function OnClientClose(oWnd) {
        oWnd.setUrl("about:blank"); // Sets url to blank
  
   </script>
  </telerik:RadScriptBlock>

The function is being accessed, as I have put some alert("test") code in there to make sure but the video continues to play and I dont know if about:blank is being set correctly.

Any help is much appreciated.
Marin Bratanov
Telerik team
 answered on 06 Nov 2012
1 answer
144 views

Hi,

I have filtering enabled in my RadGrid.The filter row is visible, but don't want the filter icons in each table cell. Please provide a method to hide all filter buttons.

Thanks,

Shinu
Top achievements
Rank 2
 answered on 06 Nov 2012
4 answers
698 views
Hi, I want to change background color of selected date in RadCalendar. I need to change backgound color of selected date to be RED , GREEN, YELLOW or ORANGE depending upon selection made by user. I found SelectedDayStype property but could not make it work on through java script.

Can someone please help me?
Eyup
Telerik team
 answered on 06 Nov 2012
1 answer
107 views
I am doing a manual update from a button click in my radgrid.

The problem that I am having is that after I have done all the insert processes, I cannot get teh edititemtemplate to close and put the radgrid back to its normal grid listing. How do I close the edittemplate?
Andrey
Telerik team
 answered on 06 Nov 2012
2 answers
50 views
Hi,

The following function is working fine in IE but the sliders are not displayed in Chrome or Firefox.

If I replace "var MyAmount = slider1.get_value();" by "var MyAmount = "1000" and the same for "var MyDuration" all is perfect.
Is it a known issue ?

Any idea about how to fix that problem to make it works in all the browsers ?

Thanks for your support ...

Herve

function RefundRange() {

        var slider1 = $find('<%= RsAmount.ClientID %>');
        var MyAmount = slider1.get_value();

        var slider2 = $find('<%= RsDuration.ClientID %>');
        var MyDuration = slider2.get_value();
       
        var MiniRefund = Math.round((((MyAmount * 7) / 100) + MyAmount) / MyDuration);
        var MaxiRefund = Math.round((((MyAmount * 14) / 100) + MyAmount) / MyDuration);


        SpanMiniRefund.innerHTML = "CHF " + MiniRefund + ".-";
        SpanMaxiRefund.innerHTML = "CHF " + MaxiRefund + ".-";
}

        
        
Herve
Top achievements
Rank 2
 answered on 06 Nov 2012
3 answers
93 views
Hello,
I'm trying to put SSRS ReportViewer controls in a RadMultiPage controlled by a RadTabStrip and RadAjaxManager.  When changing to a different tab I get the following js error for the report element:

Microsoft JScript runtime error: Sys.ArgumentException: Value must not be null for Controls and Behaviors.
Parameter name: element

<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadTabStrip1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" />
                    <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" AutoPostBack="true" MultiPageID="RadMultiPage1">
        <Tabs>
            <telerik:RadTab Text="Tab1">
            </telerik:RadTab>
            <telerik:RadTab Text="Tab2">
            </telerik:RadTab>
        </Tabs>
    </telerik:RadTabStrip>
    <telerik:RadMultiPage ID="RadMultiPage1" runat="server">
        <telerik:RadPageView ID="RadPageView1" runat="server">
            <rsweb:ReportViewer ID="ReportViewer1" runat="server" ProcessingMode="Remote">
                <ServerReport ReportPath="myPath" ReportServerUrl="myUrl" />
            </rsweb:ReportViewer>
        </telerik:RadPageView>
        <telerik:RadPageView ID="RadPageView2" runat="server">
            <rsweb:ReportViewer ID="ReportViewer2" runat="server" ProcessingMode="Remote">
                <ServerReport ReportPath="myPath" ReportServerUrl="myUrl" />
            </rsweb:ReportViewer>
        </telerik:RadPageView>
    </telerik:RadMultiPage>


Any idea what's going on?  I also tried the above by adding the reportviewers in the UpdatedControls section of the AjaxManager but that still threw an error:

<telerik:AjaxUpdatedControl ControlID="ReportViewer1" />


   I was able update the report with a normal UpdatePanel, but can't get this working.
Maria Ilieva
Telerik team
 answered on 06 Nov 2012
9 answers
166 views
I've been following the example here to allow a control in my CommandItemTemplate to export the grid to Excel.

http://www.telerik.com/community/code-library/aspnet-ajax/general/export-radgrid-content-to-excel-word-csv-pdf-with-ajax-enabled.aspx

When the page initially loads, the button works as expected and the performs the post-back which allows the data in the grid to be exported. However, if I were to press another button (not the export button) that DOES cause an Ajax response, then when I click the export button, the export button no longer causes a post-back. It's like it has reverted back to being ajaxified. 

This is in my RadGrid.ItemCreated event where I Register the Post Back on my export buttons

if (e.Item is GridCommandItem)
{
    ImageButton btnExport = (e.Item as GridCommandItem).FindControl("btnExport") as ImageButton;
    LinkButton btnExportLink = (e.Item as GridCommandItem).FindControl("btnExportLink") as LinkButton;
    RadScriptManager scriptManager = (RadScriptManager)Master.FindControl("RadScriptManager1");
    if (scriptManager != null)
    {
        scriptManager.RegisterPostBackControl(btnExport);
        scriptManager.RegisterPostBackControl(btnExportLink);
                        
    }
}

If I click a different button that causes an ajax request it breaks the exporting button. Code below that breaks the exporting.

void btnGo_Command(object sender, CommandEventArgs e)
{
    WeekNumber = Convert.ToInt32(ddlWeek.SelectedValue);
    Year = Convert.ToInt32(ddlYear.SelectedValue);
             
    SetWeekSelectWarningMessage(WeekNumber);
    SetMissingTotalsCount();
    SetPendingTotalsCount();
    grdTimecards.Rebind();
}
Kostadin
Telerik team
 answered on 06 Nov 2012
11 answers
813 views
Hello!
I have a RadGrid inside of RadWindow...
I need to select a Radgrid row in clientside...
How can I do that? 

I´m trying to get the radgrid like that: 
var masterTable = $find("<%=radgridID.ClientID%>").get_masterTableView();

but always getting null... 

Any help?


Bhavesh
Top achievements
Rank 2
 answered on 06 Nov 2012
1 answer
112 views
Hi,
Is there anyway to get the icons for the editor command buttons? Specifically, I am creating a custom version of the image manager and would like to use the icon that comes with the standard version but I can't find it in my files.
Thanks,
Matt


P.S. When I say that I am making a custom version, I just mean the button; I'm not customizing the image manager dialog.
Bozhidar
Telerik team
 answered on 06 Nov 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?