Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
139 views
Hi,

I am using RadTreeView control. After page is postback i am not able to expand and collapse the TreeNodes.
This issue is in FireFox only. It works perfectly fine in IE.


Thanks
Sumit
Schlurk
Top achievements
Rank 2
 answered on 23 Dec 2009
3 answers
134 views
I've been receiving the following error messages from my website:

System.NullReferenceException: Object reference not set to an instance of an object. at Telerik.Web.UI.RadUpload.IsValidMimeType(UploadedFile file) at Telerik.Web.UI.RadUpload.IsValidUploadedFile(UploadedFile file, Boolean checkingFileSize, Boolean checkingFileExtension, Boolean checkingMimeType) at Telerik.Web.UI.RadUpload.ValidateUploadedFiles() at Telerik.Web.UI.RadUpload.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

the user agent is :
HTTP_USER_AGENT:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.33 Safari/532.0

I'm guessing the problem is that the user is using chrome, and for some reason it's stripping the document of a mime type. Is there any workaround that anyone know of for this, or a fix? right now I'm catching the error and telling the user to use Firefox or IE, as it works perfectly there.
this is the code for the upload control
<telerik:RadUpload ID="upldResume" runat="server"  
                    ControlObjectsVisibility="ClearButtons" 
                    InputSize="50" 
                    Width="475px" 
                    MaxFileSize="500000" 
                    MaxFileInputsCount="1" 
                    ReadOnlyFileInputs="true" 
                    Enabled="true" 
                    EnableFileInputSkinning="true" 
                    AllowedFileExtensions=".pdf,.doc,.docx,.wpd,.odt,.rtf,.txt" 
                    AllowedMimeTypes="application/pdf,application/x-pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/wordperfect,application/x-wpwin,application/vnd.oasis.opendocument.text,application/x-vnd.oasis.opendocument.text,application/rtf,application/x-rtf,text/richtext,text/rtf,text/enriched,application/txt,text/plain" 
                    ToolTip="Upload a resume" 
                    /> 

Thank you,
Debbie
Genady Sergeev
Telerik team
 answered on 23 Dec 2009
1 answer
92 views
There appear to be issues regarding keyboard navigation of the RadFileExplorer. These issues are evident in the demo provided on:

http://demos.telerik.com/aspnet-ajax/fileexplorer/examples/default/defaultcs.aspx

Specifically, the issues are:

1. In Firefox, keyboard navigation of the tree does not work. Keyboard navigation of the grid is fine.
2. In IE(7+), whilst keyboard navigation of both the tree and the grid seem to work okay, navigation from the grid back to the tree is awkward (I have actually been unable to do it, so may be impossible). Forward navigation appears to be acceptable.

Yana
Telerik team
 answered on 23 Dec 2009
11 answers
2.1K+ views
When the user types the space bar, RadEditor sometimes inserts a non-breaking space character (&nbsp;). This is great, but when switching to the HTML view, RadEditor displays &nbsp; as normal spaces. There are times when you need to differentiate between a normal and non-breaking space and that now becomes very difficult to do.

Would it be possible to add a property to enable/disable non-breaking space auto-conversion while in HTML mode? EnableHtmlNonBreakingSpaceConversion or something similar?
D Strube
Top achievements
Rank 1
 answered on 23 Dec 2009
2 answers
151 views
Going through this example
http://demos.telerik.com/aspnet-ajax/treeview/examples/functionality/treeviewcombobox/defaultcs.aspx?product=treeview
of using the TreeView inside a RadCombo, Its the text values that is sent to the server, how would I get the ID to the serverside. I have added the autopostback = true as depending on the ID I have to do other things.

Andy
Andy Green
Top achievements
Rank 1
 answered on 23 Dec 2009
1 answer
117 views
Does the RadGrid support a "grouping header" (i.e., where certain columns could be grouped together)?

For example:

Sunday

Monday

Morning

Afternoon

Evening

Morning

Afternoon

Evening

 

 

 

 

 

 



Thanks!
Princy
Top achievements
Rank 2
 answered on 23 Dec 2009
0 answers
142 views
HI,
         Here is my sample code.
this is my ascx code,

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Addition.ascx.cs" Inherits="Addition" %>
<head>

    <script language="javascript">

        function test() {

            alert('hi');

        }

    </script>

</head>
<table>
    <tr>
        <td>
            Enter Value1:
        </td>
        <td>
            <input id="txt1" type="text" />
        </td>
    </tr>
    <tr>
        <td>
            Enter Value2:
        </td>
        <td>
            <input id="txt2" type="text" />
        </td>
    </tr>
    <tr>
        <td>
        </td>
        <td>
            <input type="button" id="btnAdd" value="ADD" onclick="addition1()" />
        </td>
    </tr>
    <tr>
        <td>
        </td>
        <td>
            <input id="txtResult" type="text" disabled="disabled" />
        </td>
    </tr>
</table>


and my aspx page is here

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default5.aspx.cs" Inherits="Default5"  EnableViewState="true"  %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
   
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
   
        <script type="text/javascript">

            function onTabSelected(sender, args)
             {
                var controlLocation = args.get_tab().get_text();
                ScriptService.GetControlHtml(controlLocation, SucceededCallback, onFailedWS);
            }

            function onFailedWS(error) {
                alert(error.get_message());
            }

            function SucceededCallback(result) {

                var multiPage = $find("<%=RadMultiPage1.ClientID %>");

                multiPage.trackChanges();
                var pageView = new Telerik.Web.UI.RadPageView();
                multiPage.get_pageViews().add(pageView);
                pageView.get_element().innerHTML = result;
                multiPage.commitChanges();

            }

            function onTabSelecting(sender, args) {
                if (args.get_tab().get_pageViewID()) {
                    args.get_tab().set_postBack(false);
                }
            }
            function showPageView(sender, eventArgs) {
                var item = eventArgs.get_item();
              
                var itemvalue = item.get_value();
                if (itemvalue == 0) {
                    var tabStrip = $find("<%= RadTabStrip1.ClientID %>");

                    tabStrip.trackChanges();
                    var tab = new Telerik.Web.UI.RadTab();
                    tabStrip.get_tabs().add(tab);
                    tab.set_text("Addition");
                    tabStrip.commitChanges();
                }
                else {
                    var tabStrip = $find("<%= RadTabStrip1.ClientID %>");

                    tabStrip.trackChanges();
                    var tab = new Telerik.Web.UI.RadTab();
                    tabStrip.get_tabs().add(tab);
                    tab.set_text("Multiplication");
                    tabStrip.commitChanges();

                }

                return false;

            }
        </script>

    </telerik:RadCodeBlock>
    <style type="text/css">
        body
        {
            width: 95%;
            padding-left: 20px;
            font-family: Arial;
            font-size: 10pt;
            padding-right: 20px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="ScriptManager" runat="server">
        <Services>
            <asp:ServiceReference Path="~/ScriptService.asmx" />
        </Services>
    </telerik:RadScriptManager>
    <div>
        <telerik:RadMenu ID="RadMenu1" runat="server" Flow="Vertical" Skin="Forest"
            OnClientItemClicked="showPageView">
            <Items>
                <telerik:RadMenuItem runat="server" Text="UserControl 1" Value="0">
                </telerik:RadMenuItem>
                <telerik:RadMenuItem runat="server" Text="UserControl 2" Value="1">
                </telerik:RadMenuItem>
            </Items>
        </telerik:RadMenu>
        <br />
        <telerik:RadTabStrip runat="server" ID="RadTabStrip1" MultiPageID="RadMultiPage1"
            OnClientTabSelected="onTabSelected" OnClientTabSelecting="onTabSelecting" SelectedIndex="1"
            Skin="Black">
        </telerik:RadTabStrip>
        <telerik:RadMultiPage runat="server" ID="RadMultiPage1">
        </telerik:RadMultiPage>
    </div>
    </form>
</body>
</html>


and this is my webservice

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService()]
public class ScriptService : System.Web.Services.WebService
{

    public ScriptService()
    {
        //Uncomment the following line if using designed components
        //InitializeComponent();
    }

    /// <summary>
    /// Get User Control Html
    /// use EnableSession=true if you are using session variables
    /// </summary>
    /// <returns>Html Table</returns>
    [WebMethod(EnableSession = true)]
    public string GetControlHtml(string controlLocation)
    {
        // Create instance of the page control
        Page page = new Page();

        // Create instance of the user control
        UserControl userControl = (UserControl)page.LoadControl(controlLocation);

        //Disabled ViewState- If required
        //userControl.EnableViewState = false;
       
        //Form control is mandatory on page control to process User Controls
        HtmlForm form = new HtmlForm();

        //Add user control to the form
        form.Controls.Add(userControl);
       
        //Add form to the page
        page.Controls.Add(form);

        //Write the control Html to text writer
        StringWriter textWriter = new StringWriter();

        //execute page on server
        HttpContext.Current.Server.Execute(page, textWriter, false);
       
        // Clean up code and return html
        return CleanHtml(textWriter.ToString());
    }

    /// <summary>
    /// Removes Form tags using Regular Expression
    /// </summary>
    private string CleanHtml(string html)
    {
        return Regex.Replace(html, @"<[/]?(form)[^>]*?>", "", RegexOptions.IgnoreCase);
    }

}

All that i want to know now is i want to call the onclick event which is in my ascx page.
its retuning a runtime error as object expected.
kindly help me to fix this issue

Karthi Keyan
Top achievements
Rank 1
 asked on 23 Dec 2009
1 answer
99 views
Hi,

I have a very strange issue. We are using RadGrid and TemplateColumns which contain item and editItem nodes. One column is a RadComboBox, the Other a RadTextBox (both for editItemTemplate)

When I select a drop down item from RadComboBox (selectedIndex > 0) and then click into the RadTextBox, the RadComboBox selected value resets to SelectedIndex = 0 showing the first item in the comboBox.  Here are the Grid nodes

<telerik:GridTemplateColumn HeaderText="Form Title">
                    <ItemTemplate>
                    <asp:HyperLink ID="frmLnk" runat="server"></asp:HyperLink>
                    </ItemTemplate>
                    <EditItemTemplate>
                    <telerik:RadTextBox ID="txtTitle" runat="server"></telerik:RadTextBox>
                    </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn HeaderText="Application">
                    <ItemTemplate>
                        <asp:Label ID="lblApplication" runat="server" Text="" ></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                     <telerik:RadComboBox ID="rcbApplications" runat="server">
                            </telerik:RadComboBox>
                    </EditItemTemplate>
                    </telerik:GridTemplateColumn>

No client script is being used, but it sure acts as if this is the case. The instant I click into the RadTextBox (ID txtTitle), the selected index of RadComboBox rcbApplications resets to zero. Any ideas out there what I am doing wrong?
Simon
Telerik team
 answered on 23 Dec 2009
1 answer
219 views
Hi,

I have created a custom control with a RadGrid that uses custom CSS. I have 2 issues...

1/ The ComboBox on the Pager to set the PageSize is not styled at all. There is no background and no dropdown button.
OOOPS - sorry fixed this one, forgot to include the comboBox style sheet...


2/ Some Grid Rows that have expanded down to 2 lines, text is too long so has word wrapped onto a 2nd line, on hover or row select only have the top half of the row styled with the appropriate background. Starngely this seems only to happen on the even rows, ie. not the alternating row style, the alternating rows that have expanded to 2 lines have the full height background.

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CompanyListing.ascx.cs" 
    Inherits="FORTUNA.CompanyListing" %> 
<telerik:RadGrid ID="rgCompanyListing" runat="server" DataSourceID="dsCompanyListing" 
    GridLines="Horizontal" Skin="Fortuna" EnableEmbeddedSkins="false" OnItemCommand="rgCompanyListing_ItemCommand" 
    AllowPaging="true" PageSize="20" OnItemDataBound="rgCompanyListing_ItemDataBound" Visible="false" Width="613px"
    <ClientSettings EnableRowHoverStyle="True" EnablePostBackOnRowClick="True"
    </ClientSettings> 
    <MasterTableView AutoGenerateColumns="False" BorderWidth="0px" ClientDataKeyNames="CompanyProfileID" 
        DataKeyNames="CompanyProfileID" DataSourceID="dsCompanyListing" GridLines="None" 
        ShowHeader="False" ItemStyle-BackColor="#EAEEF6"
        <NoRecordsTemplate> 
            <br>&nbsp;no results returned for that search...</br> 
        </NoRecordsTemplate> 
        <GroupByExpressions> 
            <telerik:GridGroupByExpression> 
                <SelectFields> 
                    <telerik:GridGroupByField FieldAlias="CategoryName" FieldName="CategoryName" HeaderText="Category" /> 
                </SelectFields> 
                <GroupByFields> 
                    <telerik:GridGroupByField FieldName="CategoryName" SortOrder="Ascending" HeaderText="Category" /> 
                </GroupByFields> 
            </telerik:GridGroupByExpression> 
        </GroupByExpressions> 
        <Columns> 
            <telerik:GridBoundColumn DataField="CompanyProfileID" DataType="System.Int32" Display="False" 
                HeaderText="CompanyProfileID" ReadOnly="True" SortExpression="CompanyProfileID" 
                UniqueName="CompanyProfileID" Visible="False"
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="CompanyName" HeaderText="CompanyName" SortExpression="CompanyName" 
                UniqueName="CompanyName"
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="CategoryName" HeaderText="CategoryName" SortExpression="CategoryName" 
                UniqueName="CategoryName" Visible="false"
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="Address1" HeaderText="Address" SortExpression="Address1" 
                UniqueName="Address1"
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="Town" HeaderText="Town" SortExpression="Town" 
                UniqueName="Town"
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="Postcode" HeaderText="Postcode" SortExpression="Postcode" 
                UniqueName="Postcode" ItemStyle-Width="60px"
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="County" HeaderText="County" SortExpression="County" 
                UniqueName="County"
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="ActiveStatus" HeaderText="Active" SortExpression="ActiveStatus" 
                UniqueName="ActiveStatus" Display="false"
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="Order" HeaderText="Order" SortExpression="Order" 
                UniqueName="Order" Display="false"
            </telerik:GridBoundColumn> 
        </Columns> 
    </MasterTableView> 
    <ClientSettings> 
        <Selecting AllowRowSelect="true" /> 
    </ClientSettings> 
</telerik:RadGrid> 
<asp:SqlDataSource ID="dsCompanyListing" runat="server" ConnectionString="<%$ ConnectionStrings:FORTUNAConnectionString %>"
</asp:SqlDataSource> 
 


using System; 
using System.Drawing; 
using System.Web.UI.WebControls; 
using Telerik.Web.UI; 
 
namespace FORTUNA 
    public partial class CompanyListing : System.Web.UI.UserControl, ICompanyListing 
    { 
        public event CommandEventHandler ListingClick; 
 
        public int CompanyId { get { return _companyId; } } 
        private int _companyId = 0; 
 
        public void ShowListing(int categoryId, string category, int townId, string town, bool admin) 
        { 
            ViewState["categoryId"] = categoryId; 
            ViewState["category"] = category; 
            ViewState["townId"] = townId; 
            ViewState["town"] = town; 
            ViewState["admin"] = admin; 
 
            string sql = string.Format("EXEC [dbo].[udp_CompanySearch] @CategoryId = {0}, @Category = N'{1}', @TownId = {2}, @Town = N'{3}', @Admin = {4}", categoryId, category, townId, town, admin); 
            dsCompanyListing.SelectCommand = sql; 
            rgCompanyListing.Visible = true
        } 
 
        protected void Page_Load(object sender, EventArgs e) 
        { 
            if (IsPostBack) 
            { 
                string sql = string.Format("EXEC [dbo].[udp_CompanySearch] @CategoryId = {0}, @Category = N'{1}', @TownId = {2}, @Town = N'{3}', @Admin = {4}", ViewState["categoryId"], ViewState["category"], ViewState["townId"], ViewState["town"], ViewState["admin"]); 
                dsCompanyListing.SelectCommand = sql; 
            } 
        } 
 
        protected void rgCompanyListing_ItemCommand(object source, GridCommandEventArgs e) 
        { 
            var dataItem = e.Item as GridDataItem; 
            if (dataItem != null
            { 
                var item = dataItem; 
                try 
                { 
                    _companyId = Int32.Parse(item.GetDataKeyValue("CompanyProfileID").ToString()); 
                } 
                catch (Exception) 
                { 
                    _companyId = 0; 
                } 
 
                if (ListingClick != null
                { 
                    var args = new CommandEventArgs("ListingClicked", 0); 
                    ListingClick(this, args); 
                } 
            } 
        } 
 
        protected void rgCompanyListing_ItemDataBound(object sender, GridItemEventArgs e) 
        { 
            //Is it a GridDataItem 
            if (e.Item is GridDataItem) 
            { 
                //Get the instance of the right type 
                GridDataItem dataBoundItem = e.Item as GridDataItem; 
 
                //Check the formatting condition 
                if (int.Parse(dataBoundItem["ActiveStatus"].Text) == 0) 
                { 
                    dataBoundItem.ForeColor = Color.Red; 
                } 
                else if (int.Parse(dataBoundItem["Order"].Text) > 3) 
                { 
                    dataBoundItem.BackColor = dataBoundItem.ClientRowIndex % 2 == 1 ? Color.FromArgb(255, 218, 145) : Color.FromArgb(255, 245, 225); 
                } 
            } 
        } 
    } 


EDIT: Sorry, fxed the first issue...

Cesare






Dimo
Telerik team
 answered on 23 Dec 2009
5 answers
77 views
Hi there,

I am using a Spline chart with a theme applied. If a control in the page causes a postback, the lines in my chart change color, resulting in some lines getting almost invisible.

I have created a small demo project demonstrating the problem: http://imar.spaanjaars.com/Downloads/Other/TelerikChartIssue.zip
If you open Default.aspx in the browser, there's a green and a red line. If you choose an item from the DropDownList, the page posts back and the chart changes color.

What do I need to do to fix this?

Also, what do I need to do to change the color of the lines? I changed about a million Appearance properties, but to no avail. Do I  / can I change the skin somehow?

Kind regards,

Imar
Imar
Top achievements
Rank 1
 answered on 23 Dec 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?