Telerik Forums
UI for ASP.NET AJAX Forum
8 answers
365 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
194 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
169 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
120 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
90 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
147 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
107 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
2 answers
64 views
I am using a C# code behind page, and have written some custom buttons with OnClick events on that code behind page. I simply need to determine which items are selected in the FileExplorer so that I can pass the value of the File Name(s) to a Microsoft SQL Database. Can you tell me how to find the file names of the selected files? Thank you.
AHIS - FLJAC Master License Account
Top achievements
Rank 1
 answered on 04 Mar 2011
1 answer
73 views
I  have "CHART_COLUMN" in grid and need to able to export grid  to .pdf as image.Problem is a chart.
 I saved chart as .jpeg. Could you check my code. I appreciate any help or resources.

    RadChart chart = (RadChart)item["CHART_COLUMN"].FindControl("RadChart1");
                SetChart(chart, item);
                MemoryStream imageStream = new MemoryStream();
                chart.Save(imageStream, ImageFormat.Jpeg);
                Byte[] imageContent = new Byte[imageStream.Length];
                imageStream.Position = 0;
                Response.ContentType = "image/gif";
                imageStream.Read(imageContent, 0, (Int32)imageStream.Length);
                imageStream.Close();


                RadBinaryImage rbi = (RadBinaryImage)item["chartimage"].FindControl("RadBinaryImage1");
                if (rbi != null)
                {
                    rbi.DataValue = (Byte[])imageContent;
                   // rbi.DataBind();


                }

Jelena Nahaja
Top achievements
Rank 1
 answered on 04 Mar 2011
2 answers
180 views
Hi:
I am using liquid css with my RadDatePicker, and it works fine in Casini (VS Dev), but not in IIS7.  The Css is as follows:
.field
{
    float: left;
    padding: 5px 30px 5px 0px;
    height: 35px;
}
.field h5
{
    font-size: .9em;
    font-weight: bold;
    padding: 0;
    margin: 0;
}
And the following code demonstrates the issue:
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<script runat="server">
</script>
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
            <Scripts>
                <asp:ScriptReference Path="Scripts/jquery-1.4.1.js" />
            </Scripts>
        </telerik:RadScriptManager>
        <telerik:RadAjaxPanel ID="orderSelectionRadAjaxPanel" runat="server" CssClass="ScreenWidth">
        <div style="width: 100%; margin: 0px; padding-top: 20px;">
            <div class="field">
                <h5>Top 200 Orders:</h5>
                RadComboBox
            </div>
            <div class="field">
                <h5>Start Date:</h5>
                <telerik:RadDatePicker ID="startRadDatePicker" runat="server"
                    AutoPostBack="True" >
                    <Calendar ID="Calendar1" runat="server" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x"></Calendar>
                    <DateInput ID="DateInput1" runat="server" DisplayDateFormat="M/d/yyyy" DateFormat="M/d/yyyy" AutoPostBack="True"></DateInput>
                    <DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton>
                </telerik:RadDatePicker>
                <asp:RequiredFieldValidator ID="startValidator1" runat="server"
                    ControlToValidate="startRadDatePicker" ValidationGroup="selectionValidationGroup"
                    ErrorMessage="'Start Date' is required" Text="*"
                    />
            </div>
            <div class="field">
                <h5>End Date:</h5>
                <telerik:RadDatePicker ID="endRadDatePicker" runat="server"
                    AutoPostBack="True" >
                    <Calendar ID="Calendar2" runat="server" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x"></Calendar>
                    <DateInput ID="DateInput2" runat="server" DisplayDateFormat="M/d/yyyy" DateFormat="M/d/yyyy" AutoPostBack="True"></DateInput>
                    <DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton>
                </telerik:RadDatePicker>
                <asp:RequiredFieldValidator ID="endValidator1" runat="server"
                    ControlToValidate="endRadDatePicker" ValidationGroup="selectionValidationGroup"
                    ErrorMessage="'End Date' is required" Text="*"
                    />
            </div>
            <div class="field">
                <h5>Customers:</h5>
                RadComboBox
            </div>
        </div>
       </telerik:RadAjaxPanel>
    </form>
</body>
</html>

Thanks for you help.
Phil
Phil H.
Top achievements
Rank 2
 answered on 04 Mar 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?