Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
173 views
Hi,

I'm having an issue with ASP.NET AJAX Q1 2011.

The code is very simple: I want to add a client validation function to the button save dynamically. The code is put inside JQ block 

$(document).ready(function () {
// buttonSaveClientID is defined already
$find(buttonSaveClientID).add_clicking(validationFunction);
});

There are 2 buttons on my web form: Save & Reset (which just causes a postback). When I do postback several times, the fireBug shows that $find(buttonSaveClientID) is null.

It happens occasionally. Most time the code run ok. Sometime it failed.

Do you have any idea?

Moreover, I'm guessing that it may be caused by telerik script is not finished processing. So I do a hook:

for (var i = 0; i < 1000000; i++) {
if ($find(buttonSaveClientID))
break;
}
$find(buttonSaveClientID).add_clicking(validationFunction);

and it works. Do you know how to check if telerik script is finished processing instead of such type of work around?

Georgi Tunev
Telerik team
 answered on 06 Jul 2011
2 answers
187 views
Hello,

I have a radgrid with simple text columns and an email column (link) at the end. The with of the columns is autoset by radgrid but in the last column (email link) gets no with. how can i set the column-with so that it is also auto generated?
At the moment i can't see the email column in IE, because the width is not set.

best reagards

oli
Paul
Top achievements
Rank 1
 answered on 06 Jul 2011
1 answer
137 views
I have one RadComboBox on a page with Load On Demand enabled.  I have subscribed to the ItemsRequested server side event to handle the loading of the page.  Is the called back to the server for the ItemsRequested event an AJAX call - as from what I can see it is not doing an AJAX call.  This is what I have below:

//This is the AJAX Manager where DatabaseName is a RadComboBox.  I have also subscribed to ClientEvents for Request Start and ResponseEnd - BUT THESE NEVER GET CALLED WHEN THE ITEMREQUEST EVENT IS TRIGGERED?????

 

<telerik:RadAjaxManager ID="RadAjaxManager2" OnAjaxRequest="RadAjaxManager1_AjaxRequest" runat="server"

 

<AjaxSettings>

 

<telerik:AjaxSetting AjaxControlID="DatabaseName">

 

<UpdatedControls>

 

<telerik:AjaxUpdatedControl ControlID="DatabaseName" LoadingPanelID="RadAjaxLoadingPanel2" />

</UpdatedControls>

</telerik:AjaxSetting>

 

</AjaxSettings>

 

<ClientEvents OnRequestStart="RequestStart" OnResponseEnd="ResponseEnd" />

 

</telerik:RadAjaxManager>

 

 

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server" Transparency="50" BackColor="Silver">

<div>

 

<img src="images/Loading.gif" alt="Loading..." />

</div>

</telerik:RadAjaxLoadingPanel>

 
//Here is my Rad Combo where I subscribe to the ItemsRequested event
<telerik:RadComboBox ID="DatabaseName" runat="server" Width="290px" Height="150px" ItemsPerRequest="10" 

EnableAutomaticLoadOnDemand="true" ShowMoreResultsBox="true" EnableVirtualScrolling="true"

 

DataValueField="Name" DataTextField="Name" LoadingMessage="Loading..." ShowWhileLoading="true" AutoPostBack="true"

 

OnItemsRequested="DatabaseName_ItemsRequested"

>


So basically in summary whenever the ItemRequested event if fired - it correct does some type of postback (this is my question) to the corrrect function on the server.  But in my AjaxManager I subscribe to the client events RequestStart and ResponseEnd which are never called when the ItemsRequested event is triggered on the server.  So this makes it appear that I can not intercept the call back to the server using these client events - which makes me wonder what type of post back is being done? 

Any help would be greatly appreciated.
Dimitar Terziev
Telerik team
 answered on 06 Jul 2011
1 answer
404 views
How can i open the RadNotification1 on a button click ?
Marin Bratanov
Telerik team
 answered on 06 Jul 2011
2 answers
142 views
Hi, I'm having an issue with the RadAsyncUploadControl in that any text based file will upload successfully but anything else that's in a binary format such as an image, PDF, Word document etc immediately fails (shows the red dot). This is before the postback occurs. There are no javascript errors shown and I've tried disabling the Flash module but this didn't help as it's using Silverlight.

When a file is uploaded successfully however I also get this javascript error: Error: 'fileInfo.FileName' is null or not an object

Any ideas?

thanks
Rowan
Felipe Casanova
Top achievements
Rank 1
 answered on 06 Jul 2011
1 answer
80 views
Hi

I'm trying to implement this functionality that is implemented in the RadScheduler demo
http://demos.telerik.com/aspnet-ajax/scheduler/examples/radtooltip/defaultcs.aspx
I followed the steps but i get sum javascript error. The loading tooltip is shown (the loading gif is shown) and than stops.
In this time some javascript error occurs.

I'm still trying to find what the problem is but I was wondering is it obligatory for this example to use RadScriptManager? Because in our project we use the script manager from ASP.Net.

Also if is not obligatory does any one has any clue what the problem might be.

Here is the JS error i get:
Error: contentElement is null
Source File: http://localhost/Project/ScriptResource.axd?d=A5QMaNH1dPe0O-W43eBkfORqS1JiyJ1e_xg-arzouvIvNktn1lyMkeGWVTDh4JnfrJWEuB8DhmJeQUWFshzE5w07DTl9TUyCpb8q9x6ycWJZI3JeaTd5wdQH07xrIO5pjIndVYrvbJR-q4ZgmNcOgA2&t=ffffffff89d53241
Line: 183

here is this line
if (contentElement.parentNode && contentElement.parentNode.removeChild) {
            contentElement.parentNode.removeChild(contentElement);
        }

I checked with firebug and i see that the rad scripts are called 2 times in the first time contentElement has value but parentNode is null
the second time that is called contentElement is null so the script throws error. Should it be called two times this script?

I know this is not much of a help but anyway

Regards
Marin Bratanov
Telerik team
 answered on 06 Jul 2011
2 answers
218 views
Hi,

I am using RadGrid and I have defined my radcombobox inside FilterTemplate but I want to bind that control programatically in OnItemDataBound event. I have tried to find out that control using GridDataItem but I am getting nothing. I also tried to find out that control in Grid Item_Created event but still getting nothing. 

After that I use sqldatasource to bind that control but when I load the radgrid, I can't see my radcombobox.

  <telerik:GridTemplateColumn DataField="PortalName" HeaderText="Shop" UniqueName="PortalName"
                HeaderStyle-Width="200px" SortExpression="PortalName">
                <FilterTemplate>
                    <telerik:RadComboBox ID="rcbPortal" DataTextField="PortalName" DataValueField="PortalID" DataSourceID="SqlDataSource1"
                        Height="100px" AppendDataBoundItems="true" SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("PortalName").CurrentFilterValue %>'
                        runat="server" OnClientSelectedIndexChanged="PortalIndexChanged">
                        <Items>
                            <telerik:RadComboBoxItem Text="All" />
                        </Items>
                    </telerik:RadComboBox>
                    <telerik:RadScriptBlock ID="RadScriptBlock3" runat="server">
                        <script type="text/javascript">
                            function PortalIndexChanged(sender, args) {
                                var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>");
                                tableView.filter("PortalName", args.get_item().get_value(), "EqualTo");
                            }
                        </script>
                    </telerik:RadScriptBlock>
                </FilterTemplate>
                <ItemTemplate>
                    <asp:Image ID="imgPortal" runat="server" ImageAlign="AbsBottom"  />
                    <asp:Label ID="lblPortalName" runat="server" Text='<%# Eval("PortalID") %>'></asp:Label>
                </ItemTemplate>
            </telerik:GridTemplateColumn>


Protected Sub rgOrders_ItemCreated(ByVal source As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgOrders.ItemCreated


        If TypeOf e.Item Is GridFilteringItem Then

            Dim rcbShop As RadComboBox = e.Item.FindControl("rcbPortal")


            rcbShop.DataSource = pc.GetPortals()

        End If




   End Sub
Muhammad
Top achievements
Rank 1
 answered on 06 Jul 2011
4 answers
125 views
Hi,
I'm trying to work out how to get a tab shown to the right with a horizontal sliding zone.  At the moment I have a panel with a search popup panel under it.  Looks good but would look better if the tab button that opens the search panel was on the right hand side rather than the left - the accompanying image shows what I want to achieve...

Regards,

Jon
Jon
Top achievements
Rank 1
 answered on 06 Jul 2011
7 answers
104 views

Hi!

I'm trying to reproduce the resource availability demo using ObjectDataSources instead. Trying to build the code from scratch to get to know the component. As soon as I set DataSourceId referencing an ObjectDataSource on either the Scheduler or a ResourceType the scripts from WebResource is not included in the page. Before I add the datasource, two scripts are loaded and it checks whether Sys is undefined, but when the datasource is set, the scripts are not there and it just attempts to start the initialization.
I use the Q1 2011 version.

Any ideas?
Here's the code:
(If you remove DataSourceID, GroupBy and ResourceTypes, it works fine, otherwise scripts is not loaded)

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Scheduler.aspx.cs" Inherits="TelerikPrototyping.Scheduler" %>
<%@ 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">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
     
    <telerik:RadScriptManager runat="server" ID="RadScriptManager" >
         
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadScheduler1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadScheduler" LoadingPanelID="RadAjaxLoadingPanel" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel" />
 
    <asp:ObjectDataSource runat="server"
        ID="EntriesDataSource"
        TypeName="TelerikPrototyping.Scheduler"
        SelectMethod="GetEntries"
        OnObjectCreating="OnDataSourceCreating"
        DataObjectTypeName="TelerikPrototyping.SchedulerEntry, Telerik.Calendar"
    />
     
    <asp:ObjectDataSource runat="server"
        ID="RoomsDataSource"
        TypeName="TelerikPrototyping.Scheduler"
        SelectMethod="GetRooms"
        OnObjectCreating="OnDataSourceCreating"
        DataObjectTypeName="TelerikPrototyping.Room, Telerik.Calendar"
    />
     
    <div>
        <telerik:RadScheduler runat="server"
            ID="RadScheduler"
            DataKeyField="Id"
            DataSubjectField="Subject"
            DataStartField="Start"
            DataEndField="End"
            HoursPanelTimeFormat="HH:mm"
            GroupBy="Rooms"
            DataSourceID="EntriesDataSource"
            >
            <ResourceTypes>
                <telerik:ResourceType DataSourceID="RoomsDataSource" KeyField="Id" ForeignKeyField="RoomId" TextField="Name" Name="Rooms" />
            </ResourceTypes>
        </telerik:RadScheduler>
    </div>
    </form>
</body>
</html>

 

using System;
using System.Collections.Generic;
using System.Web.UI.WebControls;
 
namespace TelerikPrototyping
{
    public partial class Scheduler : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
 
        }
 
        protected void OnDataSourceCreating(object sender, ObjectDataSourceEventArgs e)
        {
            e.ObjectInstance = this;
        }
 
        public List<SchedulerEntry> GetEntries()
        {
            return GetSessionList("entries", new SchedulerEntry("test", DateTime.Today.AddHours(13), DateTime.Today.AddHours(14), GetRooms()[0].Id, new Guid[0]));
        }
 
        public List<Room> GetRooms()
        {
            return GetSessionList("rooms", new Room("Rom 1"), new Room("Rom 2"), new Room("Rom3"));
        }
 
        public List<Person> GetPersons()
        {
            return GetSessionList("persons", new Person("Ola"), new Person("Kari"), new Person("Per"));
        }
  
        private List<T> GetSessionList<T>(string key, params T[] initial)
            where T : class
        {
            if (Session[key] == null)
                Session[key] = new List<T>(initial);
            return (List<T>) Session[key];
        }
    }
 
    public class SchedulerEntry
    {
        public Guid Id { get; private set; }
        public string Subject { get; private set; }
        public DateTime Start { get; private set; }
        public DateTime End { get; private set; }
 
        public Guid RoomId { get; private set; }
        public Guid[] PersonIds { get; private set; }
 
        public SchedulerEntry()
        {
             
        }
 
        public SchedulerEntry(Guid id, string subject, DateTime start, DateTime end, Guid roomId, Guid[] personIds)
        {
            Id = id;
            Subject = subject;
            Start = start;
            End = end;
            RoomId = roomId;
            PersonIds = personIds;
        }
 
        public SchedulerEntry(string subject, DateTime start, DateTime end, Guid roomId, Guid[] personIds)
        {
            Id = Guid.NewGuid();
            Subject = subject;
            Start = start;
            End = end;
            RoomId = roomId;
            PersonIds = personIds;
 
        }
    }
 
    public class Room
    {
        public Guid Id { get; private set; }
        public string Name { get; private set; }
 
        public Room(Guid id, string name)
        {
            Id = id;
            Name = name;
        }
 
        public Room(string name)
        {
            Id = Guid.NewGuid();
            Name = name;
        }
 
        public Room()
        {
             
        }
    }
 
    public class Person
    {
        public Guid Id { get; private set; }
        public string Name { get; private set; }
 
        public Person(Guid id, string name)
        {
            Id = id;
            Name = name;
        }
 
        public Person(string name)
        {
            Id = Guid.NewGuid();
            Name = name;
        }
    }
 
}

Never mind the Session state of the data sources - that will change when everything works. ;)

Lars-Erik

Veronica
Telerik team
 answered on 06 Jul 2011
3 answers
162 views
Hello,

I want to be able to pass an id through a querystring and select the row corresponding to that id on the grid, and that grid has paging enabled.

The code that i have working is very inefficient because in order to do this on a paged grid, I have to go through all pages, and rebind to have access to the items and see if the one I want to select is that one. I haven't found a better way to do this, does anyone knows if there is a better way to do this?

Ah, and it seems that the selected value of the combobox with the page size is and empty string when I do this instead of showing the actual size.

Thanks in advance!

if (!Page.IsPostBack)
{
    object folderOb = Request.QueryString["Folder"];
    if (folderOb == null) return;
    int folderId = int.Parse(folderOb.ToString());
 
    while (grdFolders.CurrentPageIndex < grdFolders.PageCount)
    {
        foreach (GridDataItem dataItem in grdFolders.Items)
        {
            Folder folder = dataItem.DataItem as Folder;
            if (folder.FolderId == folderId)
            {
                dataItem.Selected = true;
                grdFolderIndex.Rebind();
                return;
            }
        }
        ++grdFolders.CurrentPageIndex;
        grdFolders.Rebind();
    }
}
Daniel
Telerik team
 answered on 06 Jul 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?