Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
305 views
Hello,

I am attempting to dynamically set the width of a RadMaskedTextBox in codebehind. Everything was working fine until I decided to use custom css styling and set EnableEmbeddedBaseStylesheet="false". Once the property is set I can no longer change the width of the control in any way except through a linked style sheet. Which again doesn't work because I am setting the width dynamically in codebehind. Using the Width="XXpx" property or the Style="width: XXpx;" they are both ignored and the width of the control set to the default value.

Additionally the property EnableEmbeddedBaseStylesheet seems to have some odd behavior. I am setting it at the individual control level, so as a property of an individual RadMaskedTextBox. However if I don't set the property to false for any RadMaskedTextBox on the same page or intentionally set it to True for any one of the controls on the page then they ALL get set to true and the individual controls that have the property set to false are ignored.

Is there some way around this issue? My overall goal is simple: Use custom styling on the RadMaskedTextBox control and be able to dynamically control the width of the control at run time.  Although to be clear setting the width or style properties inline at design time still doesn't work with the EnableEmbeddedBaseStylesheet property set to false.

Thank you,
Jeremy

----- CODE SNIPPET & CORRESPONDING IMAGE FILES -----
<telerik:RadMaskedTextBox ID="RadMaskedTextBox2" runat="server" Text="RadMaskedTextBox2" Mask="aaaaaaaaaaaaaaaaa" EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="False" width="80px" />
<br />
<telerik:RadMaskedTextBox ID="RadMaskedTextBox1" runat="server" Text="RadMaskedTextBox1" Mask="aaaaaaaaaaaaaaaaa" EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false" />
See Image1.png for rendered results

<telerik:RadMaskedTextBox ID="RadMaskedTextBox2" runat="server" Text="RadMaskedTextBox2" Mask="aaaaaaaaaaaaaaaaa" EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="True" width="80px" />
<br />
<telerik:RadMaskedTextBox ID="RadMaskedTextBox1" runat="server" Text="RadMaskedTextBox1" Mask="aaaaaaaaaaaaaaaaa" EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false" />
See Image2.png for rendered results
Jeremy
Top achievements
Rank 2
 answered on 08 Jan 2013
1 answer
79 views
Hi,


I have radgrid in the page. when i click it is expanding. I want it to collapse when i click the button which is outside the grid. please do help...


Thanks
Raju
Jayesh Goyani
Top achievements
Rank 2
 answered on 08 Jan 2013
1 answer
84 views
Hi guys,

I just purchased a new machine and at present have Windows 8 and IE10 on it.  Looking through the forums I noticed that there seemed to be a lot of teething problems developing with Telerik on Windows 8 and IE10.  I am trying to make a decision on whether to nuke the operating system and put Windows 7 on it?  One thing I rely on a lot are the Telerik examples and also code written by others in the forum to learn.  Is it correct that much of this code will not work in Windows 8 and IE10?  I guess we have to bite the bullet at some stage as most new machines being shipped will have this configuration.

Just looking for your opinion on the level of compatibility of old code when developing with Windows 8 and IE10?

What type of transition problems should I expect?

Particularly interested in others that have recently made this transition!

Many thanks.

Cheers

Ian.
Slav
Telerik team
 answered on 08 Jan 2013
5 answers
203 views
Quick background - I have a grid of users that loads some information when a user (row) is selected. If some of that information changes, the page is flagged so that when a new user is picked before saving, a confirmation box appears. Clicking OK discards the changes and selects the new user, Cancel...well, cancels the new user selection. Functionally, this works fine, but even after cancelling the new row is highlighted. How can I stop this?

Relevant code:
<ClientSettings EnablePostBackOnRowClick="True">
    <Selecting AllowRowSelect="True"/>
    <Scrolling UseStaticHeaders="True" AllowScroll="True" SaveScrollPosition="True"/>
    <ClientEvents OnRowSelecting="rgUsers_RowSelecting"/>
</ClientSettings>
function rgUsers_RowSelecting(sender, args)
{
    var changed = $get("formChanged").value;
 
    if (changed > 0) {
        if(confirm("Your changes will be discarded. Click OK to continue."))
        {
            $get("hfFormChanged").value = "0";
        }
        else
        {
            args.set_cancel(true);
        }
    }
}

It is worth noting that I've tested and checked the data to make sure the select is indeed cancelled.

Edit: Also, I am forced to use Internet Explorer. Could be a factor.

Edit 2: As far as this goes, I have found the problem. I had EnablePostBackOnRowClick="True" in the ClientSettings. This was causing the ItemCommand event to be fired on the server. In ItemCommand, I was doing something with RowClick, and this was the problem. Thanks for your help.
J
Top achievements
Rank 1
 answered on 08 Jan 2013
4 answers
497 views
Hi,

 We are trying to disable the Hover CSS on the calendar. The problem is that we have multiple special days configured with a custom background class

In the C# Code on the Page_Load event

RadCalendarDay

 

testCal = new RadCalendarDay();

 

testCal.Date =

DateTime.Now;

 

testCal.Repeatable =

RecurringEvents.None;

 

testCal.ToolTip =

"SpecialDay1";

 

testCal.ItemStyle.CssClass =

"SpecialDay1";

CSS Definition

.SpecialDay1

{

 

background-color: red;

 

}


However when we hover over it uses the .rcHover class which we don't want applied.

We have tried creating a new Skin using the tutorial and removed the .RadCalendar_SpecialTest .rcRow .rcHover class without any avail. We have been able to override the .rcSelected class which works fine, however its just the .rcHover class which we have the problem with.

Can someone please help?

Cheers,
Jonathan
Patricia Ligon
Top achievements
Rank 1
 answered on 08 Jan 2013
1 answer
122 views
Hi,

I am trying to add a AutoCompleteBox on the advanced form of RadScheduler which is a provided sample from Telerik. But the control is somehow disabled after rendering, it can not take input cursor in the input box. I have tried to add other controls to the same form, they all work fine. The below are the screenshot and the code.

Thanks a lot.

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="AdvancedForm.ascx.cs"
    Inherits="RadSchedulerAdvancedFormAdvancedForm" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="scheduler" TagName="ResourceControl" Src="ResourceControl.ascx" %>
<%@ Register TagPrefix="scheduler" TagName="MultipleValuesResourceControl" Src="MultipleValuesResourceControl.ascx" %>
<div class="rsAdvancedEdit rsAdvancedModal" style="position: relative">
    <div class="rsModalBgTopLeft">
    </div>
    <div class="rsModalBgTopRight">
    </div>
    <div class="rsModalBgBottomLeft">
    </div>
    <div class="rsModalBgBottomRight">
    </div>
    <%-- Title bar. --%>
    <div class="rsAdvTitle">
        <%-- The rsAdvInnerTitle element is used as a drag handle when the form is modal. --%>
        <h1 class="rsAdvInnerTitle">
            <%= (this.Mode.ToString() == "Edit") ? Owner.Localization.AdvancedEditAppointment : Owner.Localization.AdvancedNewAppointment %></h1>
        <asp:LinkButton runat="server" ID="AdvancedEditCloseButton" CssClass="rsAdvEditClose"
            CommandName="Cancel" CausesValidation="false" ToolTip='<%# Owner.Localization.AdvancedClose %>'>
            <%= Owner.Localization.AdvancedClose %>
        </asp:LinkButton>
    </div>
    <div class="rsAdvContentWrapper">
        <%-- Scroll container - when the form height exceeds MaximumHeight scrollbars will appear on this element--%>
        <div class="rsAdvOptionsScroll">
            <asp:Panel runat="server" ID="AdvancedEditOptionsPanel" CssClass="rsAdvOptions">
                <asp:Panel runat="server" ID="BasicControlsPanel" CssClass="rsAdvBasicControls" OnDataBinding="BasicControlsPanel_DataBinding">
                    <telerik:RadTextBox runat="server" ID="SubjectText" Width="100%" Label='<%# Owner.Localization.AdvancedSubject + ":" %>'
                        EnableSingleInputRendering="false" />
                    <asp:RequiredFieldValidator runat="server" ID="SubjectValidator" ControlToValidate="SubjectText"
                        EnableClientScript="true" Display="None" CssClass="rsValidatorMsg" />
                    <ul class="rsTimePickers">
                        <li class="rsTimePick" style="width: 244px;">
                            <label for='<%= StartDate.ClientID %>_dateInput_text'>
                                <%= Owner.Localization.AdvancedFrom %>:
                            </label>
                            <%--
                                Leaving a newline here will affect the layout, so we use a comment instead.
                            --%><telerik:RadDatePicker runat="server" ID="StartDate" CssClass="rsAdvDatePicker"
                                Width="83px" SharedCalendarID="SharedCalendar" Skin='<%# Owner.Skin %>' Culture='<%# Owner.Culture %>'
                                MinDate="1900-01-01">
                                <DatePopupButton Visible="False" />
                                <DateInput ID="DateInput2" runat="server" DateFormat='<%# Owner.AdvancedForm.DateFormat %>'
                                    EmptyMessageStyle-CssClass="riError" EmptyMessage=" " EnableSingleInputRendering="false" />
                            </telerik:RadDatePicker>
                            <%--
                             
                            --%><telerik:RadTimePicker runat="server" ID="StartTime" CssClass="rsAdvTimePicker"
                                Width="65px" Skin='<%# Owner.Skin %>' Culture='<%# Owner.Culture %>'>
                                <DateInput ID="DateInput3" runat="server" EmptyMessageStyle-CssClass="riError" EmptyMessage=" "
                                    EnableSingleInputRendering="false" />
                                <TimePopupButton Visible="false" />
                                <TimeView ID="TimeView1" runat="server" Columns="2" ShowHeader="false" StartTime="08:00"
                                    EndTime="18:00" Interval="00:30" />
                            </telerik:RadTimePicker>
                        </li>
                        <li class="rsTimeZonesWrapper">
                            <telerik:RadComboBox runat="server" Visible="true" ID="TimeZonesDropDown" Width="230"
                                Label="<%# Owner.Localization.AdvancedTimeZone + ':' %>" Skin='<%# Owner.Skin %>'>
                            </telerik:RadComboBox>
                        </li>
                        <li class="rsAllDayWrapper">
                            <asp:CheckBox runat="server" ID="AllDayEvent" CssClass="rsAdvChkWrap" Checked="false" />
                        </li>
                        <li class="rsTimePick rsEndTimePick" style="width: 244px;">
                            <label for='<%= EndDate.ClientID %>_dateInput_text'>
                                <%= Owner.Localization.AdvancedTo%>:
                            </label>
                            <%--
                             
                            --%><telerik:RadDatePicker runat="server" ID="EndDate" CssClass="rsAdvDatePicker"
                                Width="83px" SharedCalendarID="SharedCalendar" Skin='<%# Owner.Skin %>' Culture='<%# Owner.Culture %>'
                                MinDate="1900-01-01">
                                <DatePopupButton Visible="False" />
                                <DateInput ID="DateInput4" runat="server" DateFormat='<%# Owner.AdvancedForm.DateFormat %>'
                                    EmptyMessageStyle-CssClass="riError" EmptyMessage=" " EnableSingleInputRendering="false" />
                            </telerik:RadDatePicker>
                            <%--
                            FT
                            --%><telerik:RadTimePicker runat="server" ID="EndTime" CssClass="rsAdvTimePicker"
                                Width="65px" Skin='<%# Owner.Skin %>' Culture='<%# Owner.Culture %>'>
                                <DateInput ID="DateInput5" runat="server" EmptyMessageStyle-CssClass="riError" EmptyMessage=" "
                                    EnableSingleInputRendering="false" />
                                <TimePopupButton Visible="false" />
                                <TimeView ID="TimeView2" runat="server" Columns="2" ShowHeader="false" StartTime="08:00"
                                    EndTime="18:00" Interval="00:30" />
                            </telerik:RadTimePicker>
                        </li>
                    </ul>
                    <div class="rsReminderWrapper">
                        <telerik:RadComboBox runat="server" ID="ReminderDropDown" Label="<%# Owner.Localization.Reminder + ':' %>"
                            Width="120px" Skin='<%# Owner.Skin %>'>
                            <Items>
                                <telerik:RadComboBoxItem Text='<%# Owner.Localization.ReminderNone %>' Value="" />
                                <telerik:RadComboBoxItem Text='<%# "0 " + Owner.Localization.ReminderMinutes %>'
                                    Value="0" />
                                <telerik:RadComboBoxItem Text='<%# "5 " + Owner.Localization.ReminderMinutes %>'
                                    Value="5" />
                                <telerik:RadComboBoxItem Text='<%# "10 " + Owner.Localization.ReminderMinutes %>'
                                    Value="10" />
                                <telerik:RadComboBoxItem Text='<%# "15 " + Owner.Localization.ReminderMinutes %>'
                                    Value="15" />
                                <telerik:RadComboBoxItem Text='<%# "30 " + Owner.Localization.ReminderMinutes %>'
                                    Value="30" />
                                <telerik:RadComboBoxItem Text='<%# "1 " + Owner.Localization.ReminderHour %>' Value="60" />
                                <telerik:RadComboBoxItem Text='<%# "2 " + Owner.Localization.ReminderHours %>' Value="120" />
                                <telerik:RadComboBoxItem Text='<%# "3 " + Owner.Localization.ReminderHours %>' Value="180" />
                                <telerik:RadComboBoxItem Text='<%# "4 " + Owner.Localization.ReminderHours %>' Value="240" />
                                <telerik:RadComboBoxItem Text='<%# "5 " + Owner.Localization.ReminderHours %>' Value="300" />
                                <telerik:RadComboBoxItem Text='<%# "6 " + Owner.Localization.ReminderHours %>' Value="360" />
                                <telerik:RadComboBoxItem Text='<%# "7 " + Owner.Localization.ReminderHours %>' Value="420" />
                                <telerik:RadComboBoxItem Text='<%# "8 " + Owner.Localization.ReminderHours %>' Value="480" />
                                <telerik:RadComboBoxItem Text='<%# "9 " + Owner.Localization.ReminderHours %>' Value="540" />
                                <telerik:RadComboBoxItem Text='<%# "10 " + Owner.Localization.ReminderHours %>' Value="600" />
                                <telerik:RadComboBoxItem Text='<%# "11 " + Owner.Localization.ReminderHours %>' Value="660" />
                                <telerik:RadComboBoxItem Text='<%# "12 " + Owner.Localization.ReminderHours %>' Value="720" />
                                <telerik:RadComboBoxItem Text='<%# "18 " + Owner.Localization.ReminderHours %>' Value="1080" />
                                <telerik:RadComboBoxItem Text='<%# "1 " + Owner.Localization.ReminderDays %>' Value="1440" />
                                <telerik:RadComboBoxItem Text='<%# "2 " + Owner.Localization.ReminderDays %>' Value="2880" />
                                <telerik:RadComboBoxItem Text='<%# "3 " + Owner.Localization.ReminderDays %>' Value="4320" />
                                <telerik:RadComboBoxItem Text='<%# "4 " + Owner.Localization.ReminderDays %>' Value="5760" />
                                <telerik:RadComboBoxItem Text='<%# "1 " + Owner.Localization.ReminderWeek %>' Value="10080" />
                                <telerik:RadComboBoxItem Text='<%# "2 " + Owner.Localization.ReminderWeeks %>' Value="20160" />
                            </Items>
                        </telerik:RadComboBox>
                    </div>
                    <asp:RequiredFieldValidator runat="server" ID="StartDateValidator" ControlToValidate="StartDate"
                        EnableClientScript="true" Display="None" CssClass="rsValidatorMsg" />
                    <asp:RequiredFieldValidator runat="server" ID="StartTimeValidator" ControlToValidate="StartTime"
                        EnableClientScript="true" Display="None" CssClass="rsValidatorMsg" />
                    <asp:RequiredFieldValidator runat="server" ID="EndDateValidator" ControlToValidate="EndDate"
                        EnableClientScript="true" Display="None" CssClass="rsValidatorMsg" />
                    <asp:RequiredFieldValidator runat="server" ID="EndTimeValidator" ControlToValidate="EndTime"
                        EnableClientScript="true" Display="None" CssClass="rsValidatorMsg" />
                    <asp:CustomValidator runat="server" ID="DurationValidator" ControlToValidate="StartDate"
                        EnableClientScript="false" Display="Dynamic" CssClass="rsValidatorMsg rsInvalid"
                        OnServerValidate="DurationValidator_OnServerValidate" />
                </asp:Panel>
                <asp:Panel runat="server" ID="AdvancedControlsPanel" CssClass="rsAdvMoreControls">
                    <label>
                        Color:
                    </label>
                    <telerik:RadColorPicker ID="AppointmentColorPicker" runat="server" CssClass="rsAdvResourceValue"
                        ShowIcon="true" PaletteModes="WebPalette">
                    </telerik:RadColorPicker>
                    <asp:Panel runat="server" ID="ResourceControls">
                        <%-- RESOURCE CONTROLS --%>
                        <ul class="rsResourceControls">
                            <li>
                                <!-- Resource controls should follow the convention Res[Resource Name] for ID -->
                                <scheduler:ResourceControl runat="server" ID="ResTeacher" Type="Teacher" Label="Teacher:"
                                    Skin='<%# Owner.Skin %>' />
                            </li>
                            <li>
                                <scheduler:MultipleValuesResourceControl runat="server" ID="ResStudent" Type="Student"
                                    Label="Student: " />
                            </li>
                            <!-- Optionally add more ResourceControl instances here -->
                        </ul>
                    </asp:Panel>
                </asp:Panel>
                <telerik:RadTextBox runat="server" ID="DescriptionText" TextMode="MultiLine" Columns="50"
                    Rows="5" Width="100%" Label='<%# Owner.Localization.AdvancedDescription + ":" %>'
                    Text='<%# Eval("Description") %>' EnableSingleInputRendering="false" />
                <span class="rsAdvResetExceptions">
                    <asp:LinkButton runat="server" ID="ResetExceptions" OnClick="ResetExceptions_OnClick" />
                </span>
                <telerik:RadSchedulerRecurrenceEditor runat="server" ID="AppointmentRecurrenceEditor" />
                <asp:HiddenField runat="server" ID="OriginalRecurrenceRule" />
                <telerik:RadCalendar runat="server" ID="SharedCalendar" Skin='<%# Owner.Skin %>'
                    CultureInfo='<%# Owner.Culture %>' ShowRowHeaders="false" RangeMinDate="1900-01-01" />
            </asp:Panel>
            <telerik:RadAutoCompleteBox ID="RadAutoCompleteBox1" runat="server" Width="400" DropDownWidth="200"
                DataSourceID="SqlDataSource1" DataTextField="Name" DataValueField="StudentID" CssClass="">               
            </telerik:RadAutoCompleteBox>
            <asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:TelerikVSXConnectionString %>"
                ProviderName="System.Data.SqlClient" SelectCommand="SELECT [StudentID], [Name] FROM [DbProvider_Students] ORDER By Name">
            </asp:SqlDataSource>
            <telerik:RadTextBox runat="server" ID="DescriptionTexta">
            </telerik:RadTextBox>
            <telerik:RadComboBox runat="server" AllowCustomText="true" DataSourceID="SqlDataSource1"
                DataTextField="Name" DataValueField="StudentID">
            </telerik:RadComboBox>
        </div>
        <asp:Panel runat="server" ID="ButtonsPanel" CssClass="rsAdvancedSubmitArea">
            <div class="rsAdvButtonWrapper">
                <asp:LinkButton runat="server" ID="UpdateButton" CssClass="rsAdvEditSave">
                    <span><%= Owner.Localization.Save %></span>
                </asp:LinkButton>
                <asp:LinkButton runat="server" ID="CancelButton" CssClass="rsAdvEditCancel" CommandName="Cancel"
                    CausesValidation="false">
                    <span><%= Owner.Localization.Cancel %></span>
                </asp:LinkButton>
            </div>
        </asp:Panel>
    </div>
</div>

Kalina
Telerik team
 answered on 08 Jan 2013
1 answer
102 views
Hello,

I am using the load on demand for creating RadTab and Pageview dynamically, the problem i am facing is that on first the page is loaded properly, and when i seleting the next tab the page causes postback and works fine too, but after that my page freezes(no postback occurs on selecting different tabs, it seems like everything freezes). I tried by removing the timer event too but did not succeed.
        <telerik:RadAjaxLoadingPanel runat="server" ID="LoadingPanel1">
        </telerik:RadAjaxLoadingPanel>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadAjaxPanelTimed">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadAjaxPanelTimed" LoadingPanelID="LoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <asp:Timer runat="server" ID="UpdateTimer" Interval="40000" />
        <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanelTimed" OnAjaxSettingCreating="RadAjaxPanelTimed_AjaxSettingCreating" >
            <telerik:RadTabStrip ID="tabSocialNetwork" runat="server" OnClientTabSelecting="OnClientTabSelecting" SelectedIndex="0" MultiPageID="radMultiPage"
               OnTabClick="OnRadTab_SocialAccountClick">
            </telerik:RadTabStrip>
            <telerik:RadMultiPage ID="radMultiPage" runat="server" RenderSelectedPageOnly="true" SelectedIndex="0" Width="100%"
                Height="500px" OnPageViewCreated="RadMultiPage1_PageViewCreated">
            </telerik:RadMultiPage>
        </telerik:RadAjaxPanel>
 
 
 
CodeBehind:
 
 
#region Load Event
        protected void Page_Load(object sender, EventArgs e)
        {
 
            if (!IsPostBack)
            {
                objSocialNetworkBF = new SocialNetworkBF();
                DataTable dtSocialAccount = objSocialNetworkBF.GetSocialAccount(compId, userId);
                ViewState["SocialAccount"] = dtSocialAccount;
                txtMessage.Attributes.Add(PureAnalyzer_WebApp.Onkeydown, PureAnalyzer_WebApp.EnterKeyPrevent);
                btnSendItNow.Attributes.Add(PureAnalyzer_WebApp.Onkeydown, PureAnalyzer_WebApp.EnterKeyPrevent);
                if (dtSocialAccount != null && dtSocialAccount.Rows.Count > 0)
                {
                    foreach (DataRow dr in dtSocialAccount.Rows)
                    {
                        SocialAccId = dr["SocialAccId"].ToString();
                        SocialAccount = dr["SocialAccount"].ToString();
                        AddTab(dr["SocialAccountScreenName"].ToString() + PureAnalyzer_WebApp.OpenBracket + dr["SocialAccount"].ToString() + PureAnalyzer_WebApp.ClosedBracket);
                       
                    }
                   // UpdateTimer.Interval = 60000;
                }
 
            }
        }
 
        #endregion
        #region Add radtab
        private void AddTab(string tabName)
        {
             
            RadTab tab = new RadTab();
            tab.Text = tabName;
            //tab.PostBack = true;
            tab.Value = tabName + "(" + SocialAccId + ")";
            tabSocialNetwork.Tabs.Add(tab);
            tab.ToolTip = tabName;
 
            if (flag)
            {
                AddPageView(tab);
                flag = false;
            }
        }
        #endregion
 
        #region OnRadTab click event
        protected void OnRadTab_SocialAccountClick(object sender, RadTabStripEventArgs e)
        {
            AddPageView(e.Tab);
            e.Tab.PageView.Selected = true;
        }
        #endregion
 
        #region Method to add pageview
        private void AddPageView(RadTab tab)
        {
            RadPageView pageView = new RadPageView();
            Guid pageViewGuid;
            pageViewGuid = Guid.NewGuid();
            string[] strAccVal = tab.Value.Split('(');
            pageView.ID = strAccVal[1].Remove(strAccVal[1].IndexOf(')')) + "," + strAccVal[2].Remove(strAccVal[2].IndexOf(')')) + "," + pageViewGuid.ToString();
            radMultiPage.PageViews.Add(pageView);
            tab.PageViewID = pageView.ID;
        }
        #endregion
 
        #region Rad multipage view created
        int Iteration = 0;
        protected void RadMultiPage1_PageViewCreated(object sender, RadMultiPageEventArgs e)
        {
            string []strPageviewID = e.PageView.ID.Split(',');
 
            if (!IsPostBack)
            {
                if (strPageviewID[0] == "Twitter")
                {
                    string userControlName = "TwitterConnect.ascx";
                    Control userControl = Page.LoadControl(userControlName);
                    Guid userControlTwitterGuid = Guid.NewGuid();
                    userControl.ID = userControlTwitterGuid.ToString() + "," + strPageviewID[1];
                    e.PageView.Controls.Add(userControl);
                }
                else if (strPageviewID[0] == "FaceBook")
                {
                    string userControlName = "FacebookConnect.ascx";
                    Control userControl = Page.LoadControl(userControlName);
                    Guid userControlFacebookGuid = Guid.NewGuid();
                    userControl.ID = userControlFacebookGuid.ToString() + "," + strPageviewID[1];
                    e.PageView.Controls.Add(userControl);
                }
            }
            else
            {
                if (strPageviewID[0] == "Twitter")
               {
                   string userControlName = "TwitterConnect.ascx";
                   Control userControl = Page.LoadControl(userControlName);
                   Guid userControlTwitterGuid = Guid.NewGuid();
                   userControl.ID = userControlTwitterGuid + "," + strPageviewID[1];
                   e.PageView.Controls.Add(userControl);
                   Iteration++;
               }
                else if (strPageviewID[0] == "FaceBook")
               {
                   string userControlName = "FacebookConnect.ascx";
                   Control userControl = Page.LoadControl(userControlName);
                   Guid userControlFacebookGuid = Guid.NewGuid();
                   userControl.ID = userControlFacebookGuid + "," + strPageviewID[1];
                   e.PageView.Controls.Add(userControl);
                   Iteration++;
               }
                
            }
             
        }
        #endregion
 
        #region RadPanel Ajaxsetting created
        protected void RadAjaxPanelTimed_AjaxSettingCreating(object sender, AjaxSettingCreatingEventArgs e)
        {
            AsyncPostBackTrigger trigger = new AsyncPostBackTrigger();
            trigger.ControlID = UpdateTimer.ID;
            trigger.EventName = "Tick";
            e.UpdatePanel.UpdateMode = UpdatePanelUpdateMode.Always;
            e.UpdatePanel.Triggers.Add(trigger);
        }
        #endregion
Peeyush
Top achievements
Rank 1
 answered on 08 Jan 2013
2 answers
124 views
I'm trying to use the RadMaskedTextBox. What I need to do is to allow the user to enter 3 different formats.

Below are examples

123

123-456

123-456-789


If he enters 132 then there is nothing different but if he types in 1234 then as soon as he enters 4, I need to display the dash. It is the same for 7. I can't use a validator as I need it on the entry and not when he is validating the page.

I thought about using a mask but I don't want to display the dash when the page loads in case he only types in 3 digits. I thought about a regular expression but I don't know how to implement only when the user is typing and not validating.

Maybe the RadMaskedTextBox is not the right control to use.

Thank you for your help.
Elisabeth
Top achievements
Rank 1
 answered on 08 Jan 2013
4 answers
381 views
I have a RadCombobox where in the first name textbox if I type a letter...it shows me list of users that begin with that letter.

<telerik:RadComboBox Visible="false" Skin="Vista" TabIndex="10" ID="rcbLastName" runat="server"
                                                           AllowCustomText="true" Width="200px" ShowToogleImage="false" EnableOverlay="true" ShowDropDownOnTextboxClick="false" DropDownWidth="200px" MaxLength="20" CausesValidation="false"
                                                           EnableLoadOnDemand="true" EnableScreenBoundaryDetection="false" ExpandDirection="Up" EnableVirtualScrolling="true" ShowMoreResultsBox="true"
                                                           AutoPostBack="True" OnClientItemsRequesting="OnClientItemsRequesting" OnClientDropDownOpening="OnClientDropDownOpening" OnItemsRequested="rcbLastName_ItemsRequested" OnSelectedIndexChanged="rcbBarNumber_SelectedIndexChanged"
                                                           ItemsPerRequest="5">

I have server side code rcbFirstName_itemsrequested that pulls the data out of the db and displays it. 
if (!String.IsNullOrEmpty(e.Text))
            {
                rcbLastName.ClearSelection();
                NameValueCollection nvc = new NameValueCollection();
                nvc.Add("LastName", e.Text);
  
                DataTable accounts = DB.ExecuteDataTable("usp_AccountsGetByLastName", nvc);
                int itemOffset = e.NumberOfItems;
                int endOffset = Math.Min(itemOffset + rcbLastName.ItemsPerRequest, accounts.DefaultView.Count);
                e.EndOfItems = endOffset == accounts.DefaultView.Count;
  
                for (int i = itemOffset; i < endOffset && i < accounts.DefaultView.Count; i++)
                {
                    string data = accounts.DefaultView[i]["FullName"].ToString();
                    if (!String.IsNullOrEmpty(accounts.DefaultView[i]["Address1"].ToString()))
                    {
                        data += " - " + accounts.DefaultView[i]["Address1"].ToString() + " ";
                        if (!String.IsNullOrEmpty(accounts.DefaultView[i]["Address2"].ToString()))
                            data += accounts.DefaultView[i]["Address2"].ToString() + " ";
                        data += accounts.DefaultView[i]["City"].ToString() + " " + accounts.DefaultView[i]["State"].ToString() + " " + accounts.DefaultView[i]["Zip"].ToString();
                    }
                    rcbLastName.Items.Add(new RadComboBoxItem(data, accounts.DefaultView[i]["AccountID"].ToString()));
                }
                if (accounts.DefaultView.Count <= 0)
                    e.Message = "No matches";
                else
                    e.Message = String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset, accounts.DefaultView.Count);
            }

The drop down is working fine. However I do not understand how to get rid of the empty Combo box item if there are no matches. Also, how to get rid of the down arrow if there are no matches. 

What do I need to do if I don't want to show the drop down if there are no matches.

Please advice!

Thanks!
Nencho
Telerik team
 answered on 08 Jan 2013
4 answers
299 views
Hi,

I'm evaluating Telerik RadGrid for our web portal software and therefore created a few prototypes. There is one behavior that strikes me: In a grid configured to allow multiple selections (using GridClientSelectColumn), after deselecting the last item of formerly selected items, the grid's SelectedIndexChanged event doesn't fire on the next postback. Every other change regarding the selection raises the event as anticipated. Is this by design? And if it is, how can I get notified about the selection change?

Thanks,

Andreas
Andreas
Top achievements
Rank 1
 answered on 08 Jan 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?