Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
163 views
Hello Community Forum members,

Please excuse me for my ignorance as I'm new to RadControls and ASP.Net Ajax. MY skill level for ASP.Net is at a high-beginner level, at best.

I'm trying to display d/b driven events in the RadCalendar control using RADControls for ASPNET Ajax. I can get the Calendar to render properly, but can't seem to get the Events to appear on the scheduled day.

Here's some background on my project:
ASP.Net 2.0 using C# and MS Sql 2005 database. After researching these forums and Google, I've discovered that the best way to do this with a calendar control is to make the d/b call once for each month and store the events data from the d/b into an Array or some type of collection vs. making up to 31 calls to the d/b for each day rendered in the month.

So, after discovering a few examples of how to do this in some older forum posts (previous to the release of RadCalendar for ASPNET Ajax, I believe), I was able to get a head start on how to do this.

Problem is, I'm running into a few errors at build time re: the DayRender and DefaultViewChanged events:  Telerik.WebControls.Base.Calendar.Events.DayRenderEventArgs

The compiler throws an error saying:
Error 143 The type or namespace name 'Base' does not exist in the namespace 'Telerik.WebControls' (are you missing an assembly reference?)

I looked in the bin directory of my project and all I saw was the following dll's:
1) RadGrid.dll (used in a previous version of Rad Controls-still works great)
2) Telerik.Web.UI.dll

I used the automatic installation to install RadControls to my VS 2005 IDE and it appears fine in the toolbox. In design mode, I inserted the Rad Calendar control on to my page and have customized it from there.

I keep thinking that there is a way to add a reference/assembly for the Telerik.WebControls.dll to the assemble, but can't locate it anywhere.

Do I even need the Telerik.WebControls.dll in this version of RadControls for ASP.Net Ajax or will the Telerik.Web.UI.dll do the trick for me?

If yes, how do I add that reference to my project?

I've tried several times to add it from the RadControls installation folder at this location:
C:\Program Files\Telerik\RadControls for ASPNET AJAX Q2 2008\Bin
but the only dll's and files I saw in there were:
1) Telerik.Charting.dll
2) Telerik.Charting.xml
3) Telerik.Web.UI.dll
4) Telerik.Web.UI.xml

I already have the Telerik.Web.UI.dll & Telerik.Web.UI.xml files in the bin directory of my project, but can't seem to get the Telerik.WebControls.dll in there.

Can anybody help me here? What am I doing wrong?

And/or - Does anybody have a better suggestion on how to display d/b driven Event data on a RADCalendar for ASP.Net Ajax control?

Any assistance would be greatly appreciated for this rookie programmer.

Thanks

Jeff O'Connell
jboconne@iupui.edu

Here is the C# code behind page I'm using for the RadCalendar:

using System;  
using System.Data;  
using System.Data.SqlClient;  
using System.Data.Odbc;  
using System.Configuration;  
using System.Collections;  
using System.Web;  
using System.Web.Security;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using System.Web.UI.WebControls.WebParts;  
using System.Web.UI.HtmlControls;  
using AnnieECasey.DataBase;  
using AnnieECasey.Lib;  
using Telerik.WebControls;  
using Telerik.Web.UI;  
 
 
 
namespace AnnieECasey  
{  
    /// <summary>  
    /// Summary description for resources_websites.  
    /// </summary>  
    public partial class resources_events : System.Web.UI.Page  
    {  
        public class EventItem  
        {  
            //===========================================        
            // Class used in building the event calendar       
            //===========================================       
            private int _EventID;  
            private System.DateTime _EventDate;  
            private string _EventName;  
            private string _EventDesc;  
            private int _EventCategoryID;  
 
            public EventItem(int EventID, System.DateTime EventDate, string EventName, string EventDesc, int EventCategoryID)  
            {  
 
                _EventID = EventID;  
                _EventDate = EventDate;  
                _EventName = EventName;  
                _EventDesc = EventDesc;  
                _EventCategoryID = EventCategoryID;  
            }  
 
            public int EventID  
            {  
                get 
                {  
                    return _EventID;  
                }  
            }  
            public System.DateTime EventDate  
            {  
                get 
                {  
                    return _EventDate;  
                }  
            }  
            public string EventName  
            {  
                get 
                {  
                    return _EventName;  
                }  
            }  
            public string EventDesc  
            {  
                get 
                {  
                    return _EventDesc;  
                }  
            }  
            public int EventCategoryID  
            {  
                get 
                {  
                    return _EventCategoryID;  
                }  
            }  
 
        }  
 
                        
        public void Page_Load(object sender, System.EventArgs e)  
        {  
            radCalEvents.SelectedDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);  
            if (!IsPostBack)  
            {  
                GetEventItems();                  
            }  
        }  
 
        // setup an array to store all of the events for the month(this is what we will access thru the DayRender event)  
        private ArrayList EventArrayList = new ArrayList();  
 
        public void GetEventItems()  
        {  
            DateTime startDate = ((MonthView)radCalEvents.CalendarView).MonthStartDate;  
            DateTime endDate = ((MonthView)radCalEvents.CalendarView).MonthEndDate;  
            SqlDataSource1.SelectParameters["MonthStartDate"].DefaultValue = startDate.ToString();  
            SqlDataSource1.SelectParameters["MonthEndDate"].DefaultValue = endDate.ToString();  
            SqlDataReader EventReader = ((SqlDataReader)((IEnumerable)SqlDataSource1.Select(DataSourceSelectArguments.Empty)));  
 
            while (EventReader.Read())  
            {  
                EventItem objEvent = new EventItem((int)EventReader["nID"], Convert.ToDateTime(EventReader["dEventDate"]), EventReader["sEventName"].ToString(), EventReader["sEventDescription"].ToString(), (int)EventReader["nEventCategoryID"]);  
                EventArrayList.Add(objEvent);  
            }  
            EventReader.Close();  
            EventReader = null;     
                                   
        }  
 
          
        protected void radCalEvents_DayRender(object sender, Telerik.WebControls.Base.Calendar.Events.DayRenderEventArgs e)  
        {  
 
            DateTime currentDate = ((Telerik.WebControls.Base.Calendar.Events.DayRenderEventArgs)e).Day.Date;  
            Table table = new Table();  
            e.Cell.Width = 95;  
            table.Width = e.Cell.Width;  
            table.Height = e.Cell.Height;  
            table.CellPadding = 0;  
            table.CellSpacing = 0;  
            // Build the row for the day number      
            TableRow dateRow = new TableRow();  
            TableCell dateCell = new TableCell();  
            dateCell.Width = e.Cell.Width;  
            dateCell.CssClass = "DayNumber";  
 
            dateCell.Text = e.Day.Date.Day.ToString();  
            dateRow.Cells.Add(dateCell);  
            table.Rows.Add(dateRow);  
 
            // Look in the arraylist for any events on this day     
            foreach (EventItem objEvent in EventArrayList)  
            {  
 
                if (objEvent.EventDate == currentDate)  
                {  
 
                    // Add a row for the event     
                    TableRow itemRow = new TableRow();  
                    TableCell itemCell = new TableCell();  
 
                    itemCell.CssClass = "EventCell";  
                    itemCell.Width = e.Cell.Width;  
 
                    // Set up the hyperlink for the event     
                    string itemText = objEvent.EventName;  
                    HyperLink itemLink = new HyperLink();  
 
                    //link to a specific page for details of the event with the eventID as the parameter    
                    itemLink.NavigateUrl = "resources_eventDetails.aspx?eventid=" + objEvent.EventID;  
                    itemLink.Text = itemText;  
                    itemLink.CssClass = "EventLink";  
                    itemLink.ToolTip = objEvent.EventDesc;  
                    itemCell.Controls.Add(itemLink);  
                    itemRow.Cells.Add(itemCell);  
                    table.Rows.Add(itemRow);  
                      
                }  
                   
            }  
        }  
 
        protected void radCalEvents_DefaultViewChanged(object sender, Telerik.WebControls.Base.Calendar.Events.DefaultViewChangedEventArgs e)  
        {  
 
            // Select events for the month when the month changes     
            GetEventItems();  
 
        }     
 

and then here is the partial code for the ASPX page:

<asp:SqlDataSource ID="SqlDataSource1" runat="server"   
                     ConnectionString="<%$ ConnectionStrings:aec_devConnectionString %>"   
                     DataSourceMode="DataReader" SelectCommand="SELECT * FROM [Event] WHERE (([dEventDate] >= @MonthStartDate) AND ([dEventDate] <= @MonthEndDate)) ORDER BY [dEventDate]">     
                        <SelectParameters>    
                            <asp:Parameter Name="MonthStartDate" Type="DateTime" />    
                            <asp:Parameter Name="MonthEndDate" Type="DateTime" />    
                        </SelectParameters>    
                    </asp:SqlDataSource>              
                    <br /> 
                    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
                    </telerik:RadScriptManager> 
                    <br /> 
                    <telerik:radajaxmanager id="RadAjaxManager1" runat="server">  
                        <AjaxSettings> 
                            <telerik:AjaxSetting AjaxControlID="radCalEvents">    
                                <UpdatedControls> 
                                    <telerik:AjaxUpdatedControl ControlID="radCalEvents"></telerik:AjaxUpdatedControl> 
                                </UpdatedControls> 
                            </telerik:AjaxSetting> 
                        </AjaxSettings> 
                    </telerik:radajaxmanager> 
                    <telerik:radcalendar id="radCalEvents" runat="server"  OnDayRender="radCalEvents_DayRender" OnDefaultViewChanged="radCalEvents_DefaultViewChanged" font-names="Arial,Verdana,Tahoma" 
                        height="500px" width="700px" ShowRowHeaders="False" Skin="WebBlue" CellAlign="Left" CellVAlign="Top" DayNameFormat="Full" ShowOtherMonthsDays="False" SingleViewRows="7" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False" EnableMultiSelect="False" NavigationCellPadding="0" PresentationType="Preview" BorderColor="SteelBlue" BorderStyle="Solid" BorderWidth="1px">  
                        <SelectedDayStyle BackColor="LightSteelBlue" ForeColor="Transparent" /> 
                        <DayStyle BorderStyle="Solid" BorderWidth="1px" Font-Names="Arial" Font-Size="Medium" 
                            Height="100px" Width="100px" Wrap="True" BorderColor="SteelBlue" HorizontalAlign="Left" VerticalAlign="Top" Font-Underline="True" /> 
                        <OtherMonthDayStyle ForeColor="Silver" Wrap="False" BorderColor="SteelBlue" BorderStyle="Solid" BorderWidth="1px" /> 
                        <TitleStyle BackColor="White" BorderColor="Transparent" Font-Names="Verdana" Font-Size="12pt" /> 
                        <WeekendDayStyle BorderStyle="Solid" BorderWidth="1px" Font-Names="Arial" Font-Size="Medium" 
                            Height="100px" VerticalAlign="Top" Width="100px" BorderColor="SteelBlue" HorizontalAlign="Left" Wrap="True" /> 
                        <CalendarTableStyle BorderColor="Transparent" HorizontalAlign="Left"    
                            VerticalAlign="Top" />                                                                                    
                    </telerik:radcalendar> 


 

Mishel
Top achievements
Rank 1
 answered on 03 Oct 2008
2 answers
197 views

Hi,
I have a problem with adding a toolbar in code in combination with the LoadToolsFile method of the RadEditor. When I use only one of them everything works fine. But when I use them both I only see the toolbar added from code. It doesn't change when I call the SetToolbar method after the creation of the dynamic toolbar.

I have the following code:

SetToolbar();

//add a new Toolbar dynamically

EditorToolGroup dynamicToolbar = new EditorToolGroup();

radTextEditor.Tools.Add(dynamicToolbar);

//add a custom dropdown and set its items and dimension attributes

EditorDropDown ddn = new EditorDropDown("DynamicDropdown");

ddn.Text =

"Dynamic dropdown";

//Set the popup width and height

ddn.Attributes[

"width"] = "110px";

ddn.Attributes[

"popupwidth"] = "240px";

ddn.Attributes[

"popupheight"] = "100px";

//Add items

ddn.Items.Add(

"Project Name", "{Project.Name}");

ddn.Items.Add(

"Person Firstname", "{Person.FirstName}");

ddn.Items.Add(

"Person Zipcode", "{Person.ZipCode}");

//Add tool to toolbar

dynamicToolbar.Tools.Add(ddn);

The method SetToolbar does the following:

private

void SetToolbar()

{

DAData dab = new DAData(ConfigurationManager.ConnectionStrings["configuration"].ConnectionString);

dab.CommandName =

"usp_RadEditorTools_Load";

dab.AddSqlParameter(

"projectId", long.Parse(ConfigurationManager.AppSettings["CNGRSProject"]));

dab.AddSqlParameter(

"resourceId", this.ResourceId);

string ret = (string)dab.GetReturnValue();

XmlDocument xmlDoc = new XmlDocument();

xmlDoc.LoadXml(ret);

radTextEditor.LoadToolsFile(xmlDoc);

radTextEditor.EnsureToolsFileLoaded();

}

I guess I'm forgetting something... but I just cannot see what that is.
Can anybody help me on this one?

Bye,

Aldert

Aldert
Top achievements
Rank 2
 answered on 03 Oct 2008
5 answers
353 views
I've seen a couple other posts mentioning problems with using the DatePicker in an edit template, but I think it's hard to replicate.  The problem I'm having is that the date window does not open, it just adds a "#" to the end of the url.

Here is the setup (there is alot of nesting, so this is the hierarchy):

MasterPage.aspx
    TestPage.aspx (refers to master page)
           GridView.ascx (user control on test page)
                EditTemplate.ascx (user control used for edit template)  
                    The date picker is on the edit template control

If I remove the radajaxmanager, i.e., un-ajaxifiy the grid, it works fine.  But it does not work w/the ajax.

Also, if I put the gridview straight on a page rather than putting it in a user control, it works fine, but I need to have it on it's own user control.

It this a case of too many nestings?  Hopefully someone will be able to recreate it.  Thanks!

-Angie

Pavel
Telerik team
 answered on 03 Oct 2008
3 answers
110 views

(I appologize if it is duplicate)

I'm trying to load a schedular in appointment mode, and get the appointment parameters like RecurrenceState and RecurrenceRule to save in my DB. How can I get AppointmentCreatedEventArgs params?

Peter
Telerik team
 answered on 03 Oct 2008
2 answers
118 views
Hi,

For some reasons, I can't see the insert button on the RadGrid.

Here is my aspx code

<telerik:RadGrid ID="RadGrid1" runat="server" AllowSorting="True" 
                AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True"
                DataSourceID="SqlDataSource1" GridLines="None" Skin="Hay"
                AllowAutomaticInserts="True"
                AllowAutomaticUpdates="True"
                AllowAutomaticDeletes="True"
                AllowMultiRowEdit="True"
                >
                <MasterTableView AutoGenerateColumns="False" DataKeyNames="ID_News"
                    DataSourceID="SqlDataSource1">
                    <RowIndicatorColumn>
                        <HeaderStyle Width="20px" />
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn>
                        <HeaderStyle Width="20px" />
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridBoundColumn DataField="ID_News" DataType="System.Int32"
                            HeaderText="ID_News" ReadOnly="True" SortExpression="ID_News"
                            UniqueName="ID_News">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Title" HeaderText="Title"
                            SortExpression="Title" UniqueName="Title">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Text" HeaderText="Text"
                            SortExpression="Text" UniqueName="Text">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Date" DataType="System.DateTime"
                            HeaderText="Date" SortExpression="Date" UniqueName="Date">
                        </telerik:GridBoundColumn>
                    </Columns>
                </MasterTableView>
                <FilterMenu EnableTheming="True" Skin="Vista">
                    <CollapseAnimation Duration="200" Type="OutQuint" />
                </FilterMenu>
            </telerik:RadGrid>
AllowAutomaticInserts="True" : this option is set up.

However, I can't see the Insert button inside the grid.

Update / Delete work fine though.

Any ideas ?
Max
Top achievements
Rank 1
 answered on 03 Oct 2008
3 answers
165 views
Hi,

have you noticed that the hover and clicked states in Firefox 3 aren't displayed unless you have the mouse cursor at the right end of the button?

You can for example see it in action here: http://www.telerik.com/DEMOS/ASPNET/Prometheus/FormDecorator/Examples/Skinning/DefaultCS.aspx

Just select a skin like Vista, that has different images for all states.

Regards,
-DJ-
Martin
Telerik team
 answered on 03 Oct 2008
1 answer
1.6K+ views
I am using Rad Controls for ASP.NET release 2008.2.804.20 and I am getting a strange behavior for Display=Dynamic, when I have tried it on several controls, when used with standard .NET validators.

For the .NET controls,
The RequiredFieldValidator checks to make sure the ControlToValidate has a value, any value. The Display property allows us to control the space taken by the control when there is no error  -- i.e Display=Dynamic collapses the space, while Display=Static reserves it.

However, when I use Display=Dynamic on a required field validitor for Rad Text Box, It displays the message all the time and it is not dynamic. Even when the entry is valid, the message is displayed.

          <telerik:RadTextBox ID="State" runat="server" TabIndex="5"
          SelectionOnFocus="CaretToBeginning" >
          <FocusedStyle BackColor="#F1F6FC" />
          </telerik:RadTextBox>
          <div class="valRequired">
      <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
       ControlToValidate="State" SetFocusOnError="True" Display="Dynamic">Required 
       </asp:RequiredFieldValidator>
       </div>

In contrast

             <asp:TextBox ID="City" runat="server" TabIndex="4" ></asp:TextBox>
           <div class="block valRequired">
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
        ControlToValidate="City" Display="Dynamic" SetFocusOnError="True">Required
        </asp:RequiredFieldValidator>
        </div>

works as expected.

How do I get your controls to work as expected with Display="Dynamic"?

Keith E.
Missing User
 answered on 03 Oct 2008
1 answer
231 views
Can RadScheduler be implemented so that each user has their own schedule... which is read/write but when others view it, the schedule is only read?

Thanks,
Jeff
Peter
Telerik team
 answered on 03 Oct 2008
2 answers
94 views
I am using a RadPanel. I click on a button inside an UpdatePanel and steadily performance degrades. After some testing it would appear that the RadPanelBar is adding an additional value to the expandedItems value.

<INPUT id=ctl15_ctl07_ctl02_ctl03_ctl02_9cfe62be-f27b-4b57-8329-46294c5e2cfe_RadPanelBar1_ClientState type=hidden value='{"expandedItems":["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],"logEntries":[],"selectedItems":[]}' name=ctl15_ctl07_ctl02_ctl03_ctl02_9cfe62be-f27b-4b57-8329-46294c5e2cfe_RadPanelBar1_ClientState autocomplete="off"

The html above was captured after a dozen or so ajax requests. If I was to do one more ajax request another element -> "0" <- would be added to the expandedItems value.

Is this a bug? or is it something I can do to stop this behaviour. I have taken the code behind my RadPanelBar out for now. Here is the markup I have got:

<telerik:RadPanelBar ID="RadPanelBar1" runat="server" Skin="Outlook" Width="100%" Height="100%" ExpandMode="SingleExpandedItem">  
    <Items> 
        <telerik:RadPanelItem Value="Locations" Text="Locations" Expanded="true" PreventCollapse="true" 
            ImageUrl="Images/office-building.png" CssClass="mainPanel">  
            <Items> 
                <%-- Current Location --%> 
                <telerik:RadPanelItem Value="CurrentLocation" Text="Current Location" Expanded="true" CssClass="subPanel" > 
                    <ItemTemplate> 
                        <div class="currentLocationDiv" id="LocationAddress"></div> 
                    </ItemTemplate> 
                </telerik:RadPanelItem> 
                  
                <%-- Sub Locations Tree --%> 
                <telerik:RadPanelItem Value="SubLocations" Text="Sub Locations" Expanded="true" CssClass="subPanel">  
                    <ItemTemplate> 
                        <asp:PlaceHolder runat="server" id="addTreeHere" /> 
                    </ItemTemplate> 
                </telerik:RadPanelItem> 
            </Items> 
        </telerik:RadPanelItem> 
    </Items> 
</telerik:RadPanelBar> 
 


Any help on this would be appreciated.

Thanks,
Martin
Martin
Top achievements
Rank 1
 answered on 03 Oct 2008
6 answers
521 views
I'v been beating my head with this the whole day and cant figure out why it doesn't work...

I'm trying to set the value of a RadTextBox with javascript and according to the documentation you should do that with the method set_value. However my browser keeps telling me that this method does not exist.

here is my code:

<%

@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="GateKeeper.Test" %>

<!

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 runat="server">

<script>

function Configuration() {

var oInput = $get('<%= TestTextBox.ClientID%>');

oInput.set_value(

'Test');

}

</script>

</telerik:RadCodeBlock>

</

head>

<

body onload="Configuration()">

<form runat="server" id="form1">

<telerik:RadScriptManager runat="server"></telerik:RadScriptManager>

<telerik:RadTextBox ID="TestTextBox" runat="server"></telerik:RadTextBox>

</form>

</

body>

</

html>

Please help!

Nicklas Johansson
Top achievements
Rank 1
 answered on 03 Oct 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?