Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
110 views
I gotta say, the webmail demo that has an Outlook like appearance is very interesting and amazing to say the least....and I would like to learn how to do something like it. Only thing is, the downloadable code is not available to download like the other demos that Telerik has available. Is there a way I can download this demo code?
Brett
Top achievements
Rank 1
 answered on 06 Mar 2011
10 answers
227 views
Hi there,

I am having some difficulty figuring if it is possible to have static resource headers with the Scheduler.
So basically I want the resource headers to remain at the top of the scheduler area when scrolling vertically.
I played around a bit with the HeaderTemplate but couldn't get what I wanted, and can't find any documentation about this.

Any suggestions?
Matthew
Top achievements
Rank 1
 answered on 06 Mar 2011
2 answers
206 views
As a test we replace one date calendar using are old code with a teleik calendar. Rendered the HTML and did file size comparison between the two. Just one telerik calendar increased our rendered HTML 26%. Our pages need to be optimized. Is there a direction someone can point me to find an optimized, light weigh code example of the raddatepicker control?
Sohail
Top achievements
Rank 1
 answered on 06 Mar 2011
8 answers
397 views
I need to export a datatable to Excel. I have a cosume control inheridet from RadPageView. basically is a TAB with other control on it. I made a Radgid dynamically like the following:
RadGrid grid = new RadGrid { AutoGenerateColumns = true }; 
grid.DataSource = dt.DefaultView;   // DT is a DataTable
grid.DataBind();
// I include also the grid to my Tab
div.Controls.AddAt(0, grid);   // Div a div container in this TAB. by running this code i can see my grid with all columns and rows
but if i add the exportSetting, and export it doesn't show the grid (What actually I want), and no Excel file neither the code that I'm using is:
grid.ExportSettings.OpenInNewWindow = true 
grid.ExportSettings.FileName = "CSV Writer
grid.MasterTableView.GridLines = GridLines.Both 
grid.MasterTableView.ShowHeader = true
grid.MasterTableView.ExportToCSV();
 
Any help would be greatly appreciated.
Daniel
Telerik team
 answered on 05 Mar 2011
2 answers
217 views
I had a custom class in css page

.RadWindow_NewAndReply
{
    width:55%;
    height:55%;
}

and in design page i am using like this

<telerik:RadWindow 
                    runat="server"
                    ID="Edit" 
                    NavigateUrl="~/Reply.aspx"
                    OnClientPageLoad="onWindowLoad"
   ReloadOnShow="true"
                    CssClass="RadWindow_NewAndReply"
                    ShowContentDuringLoad="false"
                    Modal="false"
                    Behaviors="Close,Move,Minimize,Maximize"
                    VisibleStatusbar="false">
</telerik:RadWindow>

but its not appling.. what may be the problem? 


Regards
Bhuvan
Bhuvan
Top achievements
Rank 1
 answered on 05 Mar 2011
4 answers
190 views
We have a RadWindowManager on a Page. We open RadWindows using Javascript

var oManager = GetRadWindowManager();
oManager.open("./Popup.aspx", "Popup");

Everything works fine.
When I dynamically add a RadRotator to my page using the code below the RadWindow Script stops working. Instead of opening a window the page does a postback.

radRotator.ID = "twitter" + ContentItem.ContentItemId;
radRotator.CssClass = "RSSFountainClass";
radRotator.RotatorType =(TwitterRotatorType>0) ? TwitterRotatorType : RotatorType.AutomaticAdvance;
radRotator.ScrollDirection = RotatorScrollDirection.Up;
radRotator.ScrollDuration = ScrollDuration;
radRotator.FrameDuration = FrameDuration;
radRotator.ItemTemplate = new RotatorItemTemplate(ContentItem, RSSItemTemplateClass, RSSItemDateTimeClass, RSSItemDateClass, RSSItemTimeClass, RSSItemTitleClass);
radRotator.Height = new Unit(Height, UnitType.Pixel);
radRotator.DataSource = RSSDataSource();
radRotator.InitialItemIndex = -1;
radRotator.DataBind();
 
Controls.Add(radRotator);


When i disable the handler, the script works again.

Below the handler code:

private class RotatorItemTemplate : ITemplate
{
    Label literal;
 
    private ContentItem ContentItem { get; set; }
 
    private string RSSItemTemplateClass { get; set; }
 
    private string RSSItemDateTimeClass { get; set; }
 
    private string RSSItemDateClass { get; set; }
 
    private string RSSItemTimeClass { get; set; }
 
    private string RSSItemTitleClass { get; set; }
 
    public RotatorItemTemplate(ContentItem contentItem, string rssItemTemplateClass, string rssItemDateTimeClass, string rssItemDateClass, string rssItemTimeClass, string rssItemTitleClass)
    {
        literal = new Label();
 
        ContentItem = contentItem;
        RSSItemTemplateClass = rssItemTemplateClass;
        RSSItemDateTimeClass = rssItemDateTimeClass;
        RSSItemDateClass = rssItemDateClass;
        RSSItemTimeClass = rssItemTimeClass;
        RSSItemTitleClass = rssItemTitleClass;
    }
 
    public void InstantiateIn(Control container)
    {
        literal = new Label();
        literal.DataBinding += TwitterItem_ItemDataBound;
        container.Controls.Add(literal);
    }
 
    /// <summary>
    /// TwitterItem_ItemDataBound Method
    /// </summary>
    /// <param name="sender">An object</param>
    /// <param name="e">An EventArgs</param>
    /// <returns>A void</returns>
    private void TwitterItem_ItemDataBound(object sender, EventArgs e)
    {
        Label labelControl = (Label)sender;
        RadRotatorItem rotatorItem = (RadRotatorItem)labelControl.NamingContainer;
 
        XPathNavigator xPathNavigator = ((IXPathNavigable)rotatorItem.DataItem).CreateNavigator();
 
        HtmlGenericControl htmlGenericControlItem = new HtmlGenericControl();
        htmlGenericControlItem.Attributes.Add("onclick", "window.open('" +
             ((ContentItem.FileTitle == TwitterType.Follow.ToString())
            ? xPathNavigator.SelectSingleNode("link").Value
            : xPathNavigator.SelectSingleNode("link/@href").Value)
        + "', '_blank')");
         
        if (!string.IsNullOrEmpty(RSSItemTemplateClass))
            htmlGenericControlItem.Attributes.Add("class", RSSItemTemplateClass);
        
 
        HtmlGenericControl htmlGenericControlDateTime = new HtmlGenericControl();
        if (!string.IsNullOrEmpty(RSSItemDateTimeClass))
            htmlGenericControlDateTime.Attributes.Add("class", RSSItemDateTimeClass);
 
        HtmlGenericControl htmlGenericControlTime = new HtmlGenericControl();
        if (!string.IsNullOrEmpty(RSSItemTimeClass))
            htmlGenericControlTime.Attributes.Add("class", RSSItemTimeClass);
        htmlGenericControlTime.Controls.Add(new LiteralControl(
            ((ContentItem.FileTitle == TwitterType.Follow.ToString())
                ? Convert.ToDateTime(xPathNavigator.SelectSingleNode("pubDate").Value).ToShortDateString()
            : xPathNavigator.SelectSingleNode("author/name").Value))
            );
 
        HtmlGenericControl htmlGenericControlDate = new HtmlGenericControl();
        if (!string.IsNullOrEmpty(RSSItemDateClass))
            htmlGenericControlDate.Attributes.Add("class", RSSItemDateClass);
        htmlGenericControlDate.Controls.Add(new LiteralControl(
            ((ContentItem.FileTitle == TwitterType.Follow.ToString())
            ? Convert.ToDateTime(xPathNavigator.SelectSingleNode("pubDate").Value).ToShortTimeString()
            : xPathNavigator.SelectSingleNode("updated").Value))
            );
 
        htmlGenericControlDateTime.Controls.Add(htmlGenericControlDate);
        htmlGenericControlDateTime.Controls.Add(htmlGenericControlTime);             
        htmlGenericControlItem.Controls.Add(htmlGenericControlDateTime);
 
        HtmlGenericControl htmlGenericControlTitle = new HtmlGenericControl();
        if (!string.IsNullOrEmpty(RSSItemTitleClass))
            htmlGenericControlTitle.Attributes.Add("class", RSSItemTitleClass);
        htmlGenericControlTitle.Controls.Add(new LiteralControl(
            ((ContentItem.FileTitle == TwitterType.Follow.ToString())
            ? xPathNavigator.SelectSingleNode("title").Value
             : xPathNavigator.SelectSingleNode("content").Value)));
 
        htmlGenericControlItem.Controls.Add(htmlGenericControlTitle);
 
        labelControl.Controls.Add(htmlGenericControlItem);
    }
}

Can anyone help me to solve this problem? Why does the page perform a postback after adding the Rotator handler.
Dick
Top achievements
Rank 1
 answered on 05 Mar 2011
1 answer
142 views
I am trying to figure out why a blank row is appearing between each row of data in the excel file that gets exported from my radgrid. Here is how I am doing the export:

grdMetricsClosed.ExportSettings.ExportOnlyData = true;
grdMetricsClosed.ExportSettings.IgnorePaging = true;
grdMetricsClosed.ExportSettings.OpenInNewWindow = true;
 
foreach (GridColumn col in grdMetricsClosed.MasterTableView.RenderColumns)
{
    col.Visible = true;
}
 
grdMetricsClosed.MasterTableView.ExportToExcel();

I am at a loss as to why that is happening. Anyone run into this and if so, what is the solution?
Daniel
Telerik team
 answered on 04 Mar 2011
2 answers
104 views
Hello,
I need to get to the GridItem for a record that I am inserting.  I'm actually changing the value of one of the controls in my EditItemTemplate.
Basically, the idea is the user performs some action while entering the information, and then through server-side code the value of a particular control gets changed.
But, I'm doing this outside the InsertCommand event, and can't figure out how to find it inside the RadGrid control.
Ryan Dailey
Top achievements
Rank 1
 answered on 04 Mar 2011
2 answers
160 views
I have a set of toggle buttons on a form. I want a custom image that changes states depending on a state kept in the code-behind. The code definition for the toggle buttons is here:

<telerik:RadButton ID="RadButtonOptionCapital" runat="server" OnToggleStateChanged="RadButtonOptionCapital_ToggleStateChanged"
    ToggleType="CustomToggle" ToolTip="Capital" ButtonType="ToggleButton"
    AutoPostBack="True" BorderStyle="None" >
    <ToggleStates>
    <telerik:RadButtonToggleState PrimaryIconUrl="Images/Dollar-Ironwood-16.png" Selected="true" />
    <telerik:RadButtonToggleState PrimaryIconUrl="Images/Dollar-Grey-16.png" />
    </ToggleStates>
</telerik:RadButton>

I have three of these in a row, each in their own div such that they line up nicely. In IE only, when I click one of the toggle buttons it alters its position to a few pixels higher. See the attached images. This works fine in Chrome and Firefox. Any suggestions for a workaround?

If you're wondering what I do in OnToggleStateChanged, I change the tooltip text and refresh a grid based on the setting. However I have removed the OnToggleStateChanged and it still happens. The only way to make it not happen is to set AutoPostBack to False.

Also, I think the initial position of the image is wrong, not the position after it's toggled. It remains in the toggled position no matter how many times I click it, and the final position matches the position that Chrome and Firefox renders it at. 

Steve
neebs
Top achievements
Rank 2
 answered on 04 Mar 2011
1 answer
146 views
Hello,

I have a problem in using related comboboxex in radgrid editform.

Here is my code:
ItemsMngSubUserControl.acsx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ItemsMngSubUserControl.ascx.cs" Inherits="ItemsMngSubUserControl" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
  
<%@ Register src="~/SecureSiteManagenment/SecureSQLServer/Common/UserControls/JointUserControls/FileUrlUserControl/FileUrlFileSelectorUserControl.ascx" tagname="FileUrlFileSelectorUserControl" tagprefix="uc1" %>
  
<link rel="stylesheet" type="text/css" href="../../../Common/Controls/RadEditor/RTLRadEditorStyle/Editor_RTL.css" />
<style type="text/css">
    .RightColumn
    {
        width:150px;
    }
    
    .LeftColumn
    {
        width:802px;
    }
  
    html
    {
      direction: rtl;
    }
    html, body, form
    {
      height: 100%;
      margin: 0px;
      padding: 0px;
       
    }
    /*info panel*/
  
    .infoPanel,
    .bigModule
    {
        border:1px solid #ffe58a;
        margin:1.6em 0;
        padding:1em 3em 1em 0;
        background:#fff3c8 repeat-x url(../../../Common/styles09/infoPanel.gif);
        color:#000;
    }
  
    .infoInner,
    .bigModuleBottom
    {
        min-height:30px;
        padding:0 0 0 66px;
        background:no-repeat -1184px -1447px url(../../../Common/styles09/sprite09.gif);
    }
  
    .infoPanel .title,
    .bigModule .title
    {
        display:block;
        margin:0 0 1.4em;
        padding:6px 0 0;
        font-size:1.2em;
    }
  
    .infoPanel a,
    .bigModule a
    {
        color:#f60;
    }
</style>
  
<div style="margin:10px;">
    <table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="1" rules="none"
        style="BORDER-COLLAPSE: collapse">
        <tr align="right">
            <td colspan="2">
                <b></b></td>
        </tr>
        <tr align="right">
            <td>
                <table id="Table3" cellspacing="1" cellpadding="1" width="100%" border="0">
                    <tr>
                        <td colspan="2"></td>
                    </tr>
                    <tr>
                        <td style="width:118px;">
                            <asp:Label ID="ItmNameLabel" runat="server" Text="<%$ Resources:Resource, SItemsMngSubUserControlItmNameLabel %>" ></asp:Label>
                        </td>
                        <td style="width:834px;">
                            <telerik:RadTextBox ID="ItmNameRadTextBox" runat="server" Text='<%# DataBinder.Eval( Container, "DataItem.ItmName" ) %>' Width="201px" >
                            </telerik:RadTextBox>
                        </td>
                    </tr>
                 </table>
  
                 <telerik:RadAjaxPanel ID="CtgRadAjaxPanel" runat="server">
                 <table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0">
                    <tr>
                        <td style="width:118px;">
                            <asp:Label ID="MainCtgryLabel" runat="server" Text="<%$ Resources:Resource, SItemsMngSubUserControlMainCtgryLabel %>"></asp:Label>
                        </td>
                        <td style="width:834px;">
                            <asp:XmlDataSource ID="MainCatgryXmlDataSource" runat="server" 
                                DataFile="~/Common/xml/HeaderMenu.xml"  XPath="Menu/Item[position() > 2]"></asp:XmlDataSource>
                            <telerik:RadComboBox ID="MainCatgryRadComboBox" Runat="server" 
                                DataSourceID="MainCatgryXmlDataSource" DataTextField="IText" 
                                EnableLoadOnDemand="True" AutoPostBack="true"  OffsetX="-30" BorderColor="Black" BorderWidth="1px"
                                HighlightTemplatedItems="true" Width="206px" Height="150px"
                                DataValueField="SubCtgry" SelectedIndex='<%# (Convert.ToInt32(getMainCtgryIndexIndex(DataBinder.Eval( Container, "DataItem.MainCtgry" ).ToString().Trim()))) - 2 %>'
                                onselectedindexchanged="MainCatgryRadComboBox_SelectedIndexChanged" >
                            </telerik:RadComboBox>
                               
                            <asp:XmlDataSource ID="DfosSubCategoryXmlDataSource" runat="server"  DataFile="~/Common/xml/DfosMenu.xml"  ></asp:XmlDataSource>
                            <asp:XmlDataSource ID="StudioSubCategoryXmlDataSource" runat="server"  DataFile="~/Common/xml/StudioMenu.xml" ></asp:XmlDataSource>
                            <asp:XmlDataSource ID="PrintingOnProductsSubCategoryXmlDataSource" runat="server"  DataFile="~/Common/xml/PrintingOnProductsMenu.xml" ></asp:XmlDataSource>
                            <asp:Label ID="SubCtgryDataLabel" runat="server" Visible="false" Text='<%# DataBinder.Eval( Container, "DataItem.SubCtgry" ).ToString().Trim()  %>'></asp:Label>
                            <asp:Label ID="ESubCtgryDataLabel" runat="server" Visible="false" ForeColor="Red" Text='<%# DataBinder.Eval( Container, "DataItem.ESubCtgry" ).ToString().Trim()  %>'></asp:Label>
                            <asp:Label ID="SDataLabel" runat="server" Text=""></asp:Label>
                            <telerik:RadComboBox ID="SubCtgryRadComboBox" runat="server"  
                                DataTextField="IText" DataValueField="ItemID" OffsetX="-30" 
                                BorderColor="Black" BorderWidth="1px" AutoPostBack="true"
                                EnableLoadOnDemand="True" HighlightTemplatedItems="true" Width="206px"  
                                Height="150px" 
                                onselectedindexchanged="SubCtgryRadComboBox_SelectedIndexChanged"   >
                            </telerik:RadComboBox>
                            <asp:Button ID="DisplaySubCtgryButton" Width="120px" runat="server" Text="<%$ Resources:Resource, SItemsMngSubUserControlDisplaySubCtgryButtonText %>" visible='<%# ((bool)DataBinder.Eval(Container, "OwnerTableView.IsItemInserted")) ? false : true %>' onclick="Button1_Click" />
                        </td>
                    </tr>
                 </table>
                 </telerik:RadAjaxPanel>
  
                 <table id="Table4" cellspacing="1" cellpadding="1" width="100%" border="0">
                    <tr>
                        <td class="RightColumn">
                            <asp:Label ID="ViewItmLabel" runat="server" Text="<%$ Resources:Resource, SItemsMngSubUserControlViewItmLabel %>"></asp:Label>
                        </td>
                        <td class="LeftColumn">
                            <telerik:RadComboBox ID="ViewItmRadComboBox" Skin="Vista" Width="205px" BorderColor="Black" BorderWidth="1px"
                                    SelectedValue='<%# DataBinder.Eval( Container, "DataItem.ViewItm" ).ToString() %>' AutoPostBack="false"
                                    runat="server" >                                
                                <Items>
                                    <telerik:RadComboBoxItem runat="server" Text="<%$ Resources:Resource, TelerikTrueFalseRadComboBoxTrueText %>" Value="True" />
                                    <telerik:RadComboBoxItem runat="server" Text="<%$ Resources:Resource, TelerikTrueFalseRadComboBoxFalseText %>" Value="False" />
                                </Items>
                            </telerik:RadComboBox>
                        </td>
                    </tr>
                    <tr runat="server" visible='<%# ((bool)DataBinder.Eval(Container, "OwnerTableView.IsItemInserted")) ? false : true %>'>
                      <td colspan="2">
                            
                      </td>
                    </tr>
                    <tr runat="server" visible='<%# ((bool)DataBinder.Eval(Container, "OwnerTableView.IsItemInserted")) ? false : true %>'>
                        <td class="RightColumn">
                            <asp:Label ID="InsrtUserLabel" runat="server" Text="<%$ Resources:Resource, SItemsMngSubUserControlInsrtUserLabel %>"></asp:Label>
                        </td>
                        <td class="LeftColumn">
                            <asp:Label ID="InsrtUserDataLabel" runat="server" Text='<%# ((bool)DataBinder.Eval(Container, "OwnerTableView.IsItemInserted")) ? "" : TmonavotDB.GetUserNameByUserID(Convert.ToInt64(DataBinder.Eval( Container, "DataItem.LstUpdBy" ))) %>'></asp:Label>
                        </td>
                    </tr>
                    <tr>
                      <td colspan="2">
                            
                      </td>
                    </tr>
                    <tr>
                        <td valign="top" class="RightColumn">
                            <asp:Label ID="ItmDescLabel" runat="server" Text="<%$ Resources:Resource, SItemsMngSubUserControlItmDescLabel %>"></asp:Label>
                        </td>
                        <td class="LeftColumn">
                            <telerik:RadTextBox ID="ItmDescRadTextBox" TextMode="MultiLine" Rows="4" runat="server" Text='<%# DataBinder.Eval( Container, "DataItem.ItmDesc" ) %>' Width="100%" >
                            </telerik:RadTextBox>
                              
                        </td>
                    </tr>
                    <tr>
                      <td colspan="2">
                            
                      </td>
                    </tr>
                    <tr>
                        <td class="RightColumn">
                            <asp:Label ID="ViewItmBigDescLabel" runat="server" Text="<%$ Resources:Resource, SItemsMngSubUserControlViewItmBigDescLabel %>"></asp:Label>
                        </td>
                        <td class="LeftColumn">
                            <telerik:RadComboBox ID="ViewItmBigDescRadComboBox" Skin="Vista" Width="205px" BorderColor="Black" BorderWidth="1px"
                                    SelectedValue='<%# DataBinder.Eval( Container, "DataItem.ViewItmBigDesc" ).ToString() %>' AutoPostBack="false"
                                    runat="server" >                                
                                <Items>
                                    <telerik:RadComboBoxItem runat="server" Text="<%$ Resources:Resource, TelerikTrueFalseRadComboBoxFalseText %>" Value="False" />
                                    <telerik:RadComboBoxItem runat="server" Text="<%$ Resources:Resource, TelerikTrueFalseRadComboBoxTrueText %>" Value="True" />
                                </Items>
                            </telerik:RadComboBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="RightColumn">
                            <asp:Label ID="TitleLabel" runat="server" Text="<%$ Resources:Resource, SItemsMngSubUserControlTitleLabel %>"></asp:Label>
                        </td>
                        <td class="LeftColumn">
                            <telerik:RadTextBox ID="TitleRadTextBox" runat="server" Text='<%# DataBinder.Eval( Container, "DataItem.Title" ) %>' Width="201px" >
                            </telerik:RadTextBox>
                        </td>
                    </tr>
                    <tr>
                      <td class="RightColumn" valign="top">
                          <asp:Label ID="ItmBigDescLabel" runat="server" Text="<%$ Resources:Resource, SItemsMngSubUserControlItmBigDescLabel %>"></asp:Label>
                      </td>
                      <td class="LeftColumn"  valign="top">
                            <telerik:RadEditor runat="server" ID="ItmBigDescRadEditor" Height="350px" Width="100%" Content='<%# DataBinder.Eval( Container, "DataItem.ItmBigDesc") %>'
                                    DialogsCssFile="~/Common/Controls/RadEditor/RTLRadEditorStyle/RadEditor_Dialogs_RTL.css" ContentAreaCssFile="~/Common/Controls/RadEditor/RTLRadEditorStyle/EditorContentArea_RTL.css">
                                <Modules>
                                    <telerik:EditorModule Visible="false" />
                                </Modules>
                                <ImageManager ViewPaths="~/Pages/Design/Imgs/Itms" DeletePaths="~/Pages/Design/Imgs/Itms" UploadPaths="~/Pages/Design/Imgs/Itms" />
                                <DocumentManager ViewPaths="~/Pages/Design/Imgs/Itms" DeletePaths="~/Pages/Design/Imgs/Itms" UploadPaths="~/Pages/Design/Imgs/Itms" />
                                <MediaManager ViewPaths="~/Pages/Design/Imgs/Itms" DeletePaths="~/Pages/Design/Imgs/Itms" UploadPaths="~/Pages/Design/Imgs/Itms" />
                            </telerik:RadEditor>
                      </td>
                   </tr>
                   <tr>
                      <td colspan="2">
                            
                      </td>
                    </tr>
                    <tr>
                        <td class="RightColumn">
                            <asp:Label ID="ViewPriceLabel" runat="server" Text="<%$ Resources:Resource, SItemsMngSubUserControlViewPriceLabel %>"></asp:Label>
                        </td>
                        <td class="LeftColumn">
                            <telerik:RadComboBox ID="ViewPriceRadComboBox" Skin="Vista" Width="205px" BorderColor="Black" BorderWidth="1px"
                                    SelectedValue='<%# DataBinder.Eval( Container, "DataItem.ViewPrice" ).ToString() %>' AutoPostBack="false"
                                    runat="server" >                                
                                <Items>
                                    <telerik:RadComboBoxItem runat="server" Text="<%$ Resources:Resource, TelerikTrueFalseRadComboBoxFalseText %>" Value="False" />
                                    <telerik:RadComboBoxItem runat="server" Text="<%$ Resources:Resource, TelerikTrueFalseRadComboBoxTrueText %>" Value="True" />
                                </Items>
                            </telerik:RadComboBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="RightColumn">
                            <asp:Label ID="ItemPriceLabel" runat="server" Text="<%$ Resources:Resource, SItemsMngSubUserControlItemPriceLabel %>"></asp:Label>
                        </td>
                        <td class="LeftColumn">
                            <telerik:RadNumericTextBox ID="ItemPriceRadNumericTextBox" runat="server" DbValue='<%# DataBinder.Eval( Container, "DataItem.ItemPrice" ) %>' Width="201px" >
                            </telerik:RadNumericTextBox>
                        </td>
                    </tr>
                    <tr>
                      <td colspan="2">
                            
                      </td>
                    </tr>
                    <tr>
                        <td class="RightColumn">
                            <asp:Label ID="ViewImgLabel" runat="server" Text="<%$ Resources:Resource, SItemsMngSubUserControlViewImgLabel %>"></asp:Label>
                        </td>
                        <td class="LeftColumn">
                            <telerik:RadComboBox ID="ViewImgRadComboBox" Skin="Vista" Width="205px" BorderColor="Black" BorderWidth="1px"
                                    SelectedValue='<%# DataBinder.Eval( Container, "DataItem.ViewImg" ).ToString() %>' AutoPostBack="false"
                                    runat="server" >                                
                                <Items>
                                    <telerik:RadComboBoxItem runat="server" Text="<%$ Resources:Resource, TelerikTrueFalseRadComboBoxTrueText %>" Value="True" />
                                    <telerik:RadComboBoxItem runat="server" Text="<%$ Resources:Resource, TelerikTrueFalseRadComboBoxFalseText %>" Value="False" />
                                </Items>
                            </telerik:RadComboBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="RightColumn">
                            <asp:Label ID="ImgUrlLabel" runat="server" Text="<%$ Resources:Resource, SItemsMngSubUserControlImgUrlLabel %>"></asp:Label>
                        </td>
                        <td class="LeftColumn"
                            <uc1:FileUrlFileSelectorUserControl ID="FileUrlFileSelectorUserControl1" 
                                runat="server" />
                        </td>
                    </tr>
                 </table>
               </td>
         </tr>
    
        
        <tr>
            <td align="left" colspan="2">
                <asp:button id="btnUpdate" text="<%$ Resources:Resource, TelerikRadGridEditFormUpdateButtonText %>" runat="server" CommandName="Update" Visible='<%# !(DataBinder.Eval( Container, "DataItem") is Telerik.Web.UI.GridInsertionObject) %>'></asp:button>
                <asp:button id="btnInsert" text="<%$ Resources:Resource, TelerikRadGridEditFormInsertButtonText %>" runat="server" CommandName="PerformInsert" Visible='<%# DataBinder.Eval( Container, "DataItem") is Telerik.Web.UI.GridInsertionObject %>'></asp:button>
                   
                <asp:button id="btnCancel" text="<%$ Resources:Resource, TelerikRadGridEditFormCancelButtonText %>" runat="server" causesvalidation="False" commandname="Cancel"></asp:button></td>
        </tr>
    </table>
  
</div>

ItemsMngSubUserControl.ascx.cs
using System;
using System.Configuration;
using Telerik.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
using System.Web.UI.WebControls;
using System.Web;
using System.Data;
using System.Data.SqlClient;
  
public partial class ItemsMngSubUserControl : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
            (FileUrlFileSelectorUserControl1.FindControl("TopicLabel") as Label).Text = "ItemsMng";
            string eSubCtgry = string.Empty;
            eSubCtgry = ESubCtgryDataLabel.Text.ToString().Trim();
  
            string subCtgry = string.Empty;
            subCtgry = SubCtgryDataLabel.Text.ToString().Trim();
            RadComboBoxItem item = new RadComboBoxItem();
            if (eSubCtgry.Contains("Dfos"))
            {
                SubCtgryRadComboBox.DataSourceID = "DfosSubCategoryXmlDataSource";
                SubCtgryRadComboBox.DataBind();
          SubCtgryRadComboBox.SelectedIndex = (Convert.ToInt32(getSubCtgryIndex(subCtgry, "Dfos")));                                 
                SubCtgryRadComboBox.Enabled = true;
            }
            else if (eSubCtgry.Contains("Studio"))
            {
                SubCtgryRadComboBox.DataSourceID = "StudioSubCategoryXmlDataSource";
                SubCtgryRadComboBox.DataBind();
                SubCtgryRadComboBox.SelectedIndex = (Convert.ToInt32(getSubCtgryIndex(subCtgry, "Studio")));                                 
                SubCtgryRadComboBox.Enabled = true;   
            }
            else if (eSubCtgry.Contains("PrintingOnProducts"))
            {
                SubCtgryRadComboBox.DataSourceID = "PrintingOnProductsSubCategoryXmlDataSource";
                SubCtgryRadComboBox.DataBind();
                SubCtgryRadComboBox.SelectedIndex = (Convert.ToInt32(getSubCtgryIndex(subCtgry, "PrintingOnProducts")));                                 
                SubCtgryRadComboBox.Enabled = true;               }
  
                
    }
  
    protected void SubCtgryRadComboBox_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        SubCtgryDataLabel.Text = e.Text.ToString();
    }
  
    protected void Button1_Click(object sender, EventArgs e)
    {
        SubCtgryRadComboBox.SelectedIndex = (Convert.ToInt32(getSubCtgryIndex(SubCtgryDataLabel.Text.ToString().Trim(), ESubCtgryDataLabel.Text.ToString().Trim())));
    }
  
    public string getMainCtgryIndexIndex(string _text)
    {
        string uu = string.Empty;
        XmlDocument doc = new XmlDocument();
        doc.Load(Server.MapPath("~/Common/xml/HeaderMenu.xml"));
        XmlNodeList nodes = doc.SelectNodes("/Menu/Item");
        foreach (XmlNode _uu in nodes)
        {
            foreach (XmlAttribute ss in _uu.Attributes)
            {
                if (ss.Name.Equals("IText"))
                {
                    if (ss.Value.Equals(_text))
                    {
                        uu = Convert.ToString(_uu.Attributes[0].Value);
                    }
                }
            }
        }
  
        if (uu.Equals(string.Empty))
        {
  
            return "0";
        }
        else
        {
            return uu;
        }
  
    }
  
    public string getSubCtgryIndex(string _text, string _subCtgry)
    {
        string uu = string.Empty;
        XmlDocument doc = new XmlDocument();
        doc.Load(Server.MapPath("~/Common/xml/" + _subCtgry + "Menu.xml"));
        XmlNodeList nodes = doc.SelectNodes("/Menu/Item");
        foreach (XmlNode _uu in nodes)
        {
            foreach (XmlAttribute ss in _uu.Attributes)
            {
                if (ss.Name.Equals("IText"))
                {
                    if (ss.Value.Equals(_text))
                    {
                        uu = Convert.ToString(_uu.Attributes[0].Value);
                    }
                }
            }
        }
  
        if (uu.Equals(string.Empty))
        {
  
            return "0";
        }
        else
        {
            return uu;
        }
  
    }
  
    protected void MainCatgryRadComboBox_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        string tt = e.Value.ToString().Trim();
        if (tt.Contains("Dfos"))
        {
            SubCtgryRadComboBox.DataSourceID = "DfosSubCategoryXmlDataSource";
            SubCtgryRadComboBox.DataBind();
            SubCtgryRadComboBox.Enabled = true;
            SubCtgryRadComboBox.Text = "";
            SubCtgryDataLabel.Text = Resources.Resource.SecureSecureSQLServerItemsMngSubCtgryText.ToString();
        }
        else if (tt.Contains("Studio"))
        {
            SubCtgryRadComboBox.DataSourceID = "StudioSubCategoryXmlDataSource";
            SubCtgryRadComboBox.DataBind();
            SubCtgryRadComboBox.Enabled = true;
            SubCtgryRadComboBox.Text = "";
            SubCtgryDataLabel.Text = Resources.Resource.SecureSecureSQLServerItemsMngSubCtgryText.ToString();
        }
        else if (tt.Contains("PrintingOnProducts"))
        {
            SubCtgryRadComboBox.DataSourceID = "PrintingOnProductsSubCategoryXmlDataSource";
            SubCtgryRadComboBox.DataBind();
            SubCtgryRadComboBox.Enabled = true;
            SubCtgryRadComboBox.Text = "";
            SubCtgryDataLabel.Text = Resources.Resource.SecureSecureSQLServerItemsMngSubCtgryText.ToString();
        }
        else
        {
            SubCtgryRadComboBox.DataSourceID = "";
            SubCtgryRadComboBox.DataBind();
            SubCtgryRadComboBox.Enabled = false;
        }
          
    }
  
  
   
}

In the above code, I'm trying to set different DataSourceID for SubCtgryRadComboBox depending on MainCatgryRadComboBox Value and display SubCtgryRadComboBox  items (In Update mode, the selectedIndex must be displayed regarding the changes of SubCtgryRadComboBox  .

Please, I need your help,
It is apprecited to send me the modified code.

Regards,
Bader
Kalina
Telerik team
 answered on 04 Mar 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?