Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
126 views
Hello,

I'm building a RadCalendar with ToolTip to show the time and summary of the events. The example "RadToolTip for RadCalendar " is very helpful, but i'm having a problem that there's always an error "Return Integer.Parse(result.ToString())"--- Input string was not in a correct format. The difference is that I didn't use int for the eventID as the example did, i used uniqueidentifier.
Private Function IsDayRegisteredForTooltip(ByVal [date] As DateTime) As Integer 
        
        Dim connectionString As String = ConfigurationManager.ConnectionStrings("eCalendarConnectionString").ConnectionString 
        Dim con As New SqlConnection(connectionString) 
        
        Dim cmd As New SqlCommand("SELECT GUID FROM tblActivities WHERE convert( varchar(10), Start, 101 ) = convert( varchar(10), @Start, 101 )", con) 
        cmd.Parameters.Add(New SqlParameter("@Start", [date])) 
 
        
        Using con 
            con.Open() 
            Dim result As Object = cmd.ExecuteScalar() 
             
            If result <> Nothing Then 
                Return Integer.Parse(result.ToString()) 
                
            End If 
 
            Return -1 
        End Using 
    End Function 

When I debugged, the result is always 0.
Can someone help me with this? Thank you very much for your help !

Petio Petkov
Telerik team
 answered on 27 May 2010
0 answers
364 views
In order to get familiar in a fast and pretty straight-forward manner with RadEditor for ASP.NET AJAX, I suggest you visit the online resources linked below:

RadEditor End-User Manual

Online examples

Online documentation

Step-by-step tutorial

Code library

Knowledge base

Blogs

Videos

Of course, you can browse the public forum as well in order to find a specific information/code sample concerning an aspect of the editor object model/ features. There are numerous threads which can get you started/assist you through the development process.

If you think you have an interesting project implementation with the editor that would benefit the community, we will gladly reward you for posting it in the Code library of RadEditor. So feel free to share your projects for others to learn more about all the amazing things RadEditor can do.

Finally, we will appreciate your feedback on the structure/content of the online resources - our goal is to continue enriching them, thus facilitating our customers even more.
Telerik Admin
Top achievements
Rank 1
Iron
 asked on 27 May 2010
2 answers
74 views

The following code shows a Grid control hierarchy being created from the page Init function. Data is displayed along with filter controls but no filter action takes place when requested.

using System;  
using System.Collections.Generic;  
using System.Linq;  
using System.Web;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using System.Data;  
using System.Data.Odbc;  
using Telerik.Web.UI;  
 
namespace preTOPS  
{  
    public partial class Home : System.Web.UI.Page  
    {  
        OdbcConnection connection;  
 
        protected override void OnInit(EventArgs e)  
        {  
            base.OnInit(e);  
 
            connection = Master.connection;  
 
            try  
            {  
                if (Session["user"] == null)  
                    throw new Exception("@You must be logged in to view this page. Please <a href='Default.aspx' style='color:White; text-decoration:underline;'>login</a>.");  
 
                DefineGridStructure();  
            }  
            catch (Exception ex)  
            {  
                MyUtilities.DoError(Master.maindiv, Master.errordiv, Master.lblError, ex, connection, null, Master.GetUserName());  
            }  
        }  
 
        protected void Page_Load(object sender, EventArgs e)  
        {  
            if (!Master.maindiv.Visible)  
                return;  
 
            //RadGrid grid = (RadGrid)divgrid.FindControl("grid1");  
            //RadAjaxManager1.AjaxSettings.AddAjaxSetting(grid, grid);  
        }  
 
        private void DefineGridStructure()  
        {  
            RadGrid grid = new RadGrid();  
 
            grid.ID = "grid1";  
            grid.Width = Unit.Percentage(100);  
            grid.PageSize = 10;  
            grid.AllowPaging = true;  
            grid.AllowSorting = true;  
            grid.AllowFilteringByColumn = true;  
            grid.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;  
            grid.AutoGenerateColumns = false;  
            grid.GroupingEnabled = true;  
            grid.ShowGroupPanel = true;  
            grid.ShowStatusBar = true;  
            grid.ClientSettings.AllowDragToGroup = true;  
            grid.NeedDataSource += new GridNeedDataSourceEventHandler(grid_NeedIndications);  
            grid.MasterTableView.PageSize = 15;  
            grid.MasterTableView.DataKeyNames = new string[] { "indication" };  
 
            GridBoundColumn c = new GridBoundColumn();  
            c.DataField = "indication";  
            c.HeaderText = "Indication";  
            c.SortExpression = "indication";  
            c.UniqueName = "indication";  
            c.AllowSorting = true;  
            c.AllowFiltering = true;  
            c.DataType = System.Type.GetType("System.String");  
            grid.MasterTableView.Columns.Add(c);  
//          grid.MasterTableView.GroupByExpressions.Add(new GridGroupByExpression("Indication Group By Indication"));  
 
            GridTableView tvProtocols = new GridTableView(grid);  
            tvProtocols.Width = Unit.Percentage(100);  
            tvProtocols.DataKeyNames = new string[] { "protocol" };  
            //tvProtocols.AllowFilteringByColumn = true;  
            tvProtocols.AllowSorting = true;  
            tvProtocols.AllowMultiColumnSorting = true;  
            tvProtocols.AllowPaging = true;  
 
            c = new GridBoundColumn();  
            c.DataField = "protocol";  
            c.HeaderText = "Protocol";  
            c.SortExpression = "protocol";  
            c.UniqueName = "protocol";  
            c.AllowSorting = true;  
            c.AllowFiltering = true;  
            c.DataType = System.Type.GetType("System.String");  
            tvProtocols.Columns.Add(c);  
 
            c = new GridBoundColumn();  
            c.DataField = "sponsor";  
            c.HeaderText = "Sponsor";  
            c.UniqueName = "sponsor";  
            c.SortExpression = "sponsor";  
            c.AllowSorting = true;  
            c.AllowFiltering = true;  
            c.DataType = System.Type.GetType("System.String");  
            tvProtocols.Columns.Add(c);  
 
            c = new GridBoundColumn();  
            c.DataField = "shorttitle";  
            c.HeaderText = "Short Title";  
            c.AllowSorting = true;  
            c.AllowFiltering = true;  
            c.DataType = System.Type.GetType("System.String");  
            tvProtocols.Columns.Add(c);  
 
            c = new GridBoundColumn();  
            c.DataField = "cro";  
            c.HeaderText = "CRO";  
            c.AllowSorting = true;  
            c.AllowFiltering = true;  
            c.DataType = System.Type.GetType("System.String");  
            tvProtocols.Columns.Add(c);  
 
            GridRelationFields rf = new GridRelationFields();  
            rf.MasterKeyField = "indication";  
            rf.DetailKeyField = "indication";  
            tvProtocols.ParentTableRelation.Add(rf);  
 
            grid.MasterTableView.DetailTables.Add(tvProtocols);  
 
            divgrid.Controls.Add(grid);  
        }  
 
        void grid_NeedIndications(object source, GridNeedDataSourceEventArgs e)  
        {  
            OdbcCommand command1 = new OdbcCommand("select indication from indications order by indication asc;", connection);  
            OdbcDataReader reader1 = command1.ExecuteReader();  
            RadGrid grid = (RadGrid)divgrid.FindControl("grid1");  
            grid.DataSource = reader1;  
 
            OdbcCommand command2 = new OdbcCommand("select * from protocols;", connection);  
            OdbcDataReader reader2 = command2.ExecuteReader();  
            grid.MasterTableView.DetailTables[0].DataSource = reader2;  
        }  
 
    }  
}  
 

I have done a lot of searching on this forum but haven't found the answer yet.

It would be really nice if examples included more instances of programmatic creation of data sources rather than relying almost exclusively on declarative data sources, which I never use.

Thanks

Veli
Telerik team
 answered on 27 May 2010
7 answers
744 views
Hi,

I'm using the hierarchical grid scenario to display records and child records using templates. Everything is expanded and will never be collapsed.

How do I remove the expand/collapse column that is automatically generated by Radgrid?

Thanks,

Ken
Sebastian
Telerik team
 answered on 27 May 2010
1 answer
187 views
Hello,

With resources, is it possible to have some of the resources required and some optional?  What I mean is can the Scheduler do the validation, like it does for the subject message?

Thanks.
T. Tsonev
Telerik team
 answered on 27 May 2010
1 answer
50 views
Does the Telerik Editor comply with the Authoring Tool Accessibility Guidelines www.w3.org/TR/ATAG10 . If not does the company plan to comply with these guidelines?

Rumen
Telerik team
 answered on 27 May 2010
3 answers
821 views

Join Todd Anglin, Telerik Chief Evangelist and Microsoft MVP, for the free “RadGrid for ASP.NET AJAX Optimization: Part 1” webinar that will take place on Thursday, October 1st from 11:00 am until 12:00 pm EDT.

In this week’s webinar, we will look at how you can optimize the performance of the RadGrid for ASP.NET AJAX for data operations over the web. The following five categories will be discussed:

  • Viewstate management
  • Column editor optimization
  • Conditional rendering
  • Ajaxification
  • Resource management.

There are, of course, many other optimization strategies, and we will dive deeper in to those tips and tricks in part two of this webinar series.

The webinar will take place on October 1st , 11:00am EDT.

Book your seat now!

Sebastian
Telerik team
 answered on 27 May 2010
4 answers
100 views
I have a couple of questions on filtering and the radgrid.
1. I have a grid with a couple of the columns that aren't shown but the users want to be able to filter off of those rows. Is it possible to use a rad window to let them enter their filter criteria in textboxes and pass that to the radgrid when it closes or is there a better way to do this? Is there an example or demo I can look at for this?

2. I have another radgrid that the users want a drop down to be able to select multiple values to filter off of in a column. Can I use the radcombobox to do this or is there a better way? Is there an example or demo I can look at for this?

With both of these grids I use a webservice to return data and then put the data into a datatable and then bind a dataview of that datatable to the grid.

Thank you very much for your help.
Chris
Mira
Telerik team
 answered on 27 May 2010
1 answer
142 views
First off: Hello! this my first post here, and I have an annoying issue that arises with google chrome.

here's a screenshot: http://img208.imageshack.us/img208/448/gridproblem.png

I started out using the Web Mail demo from this site for the layout. It worked nicely. Then I decided I would to like to put some common layouts and functionality into a templated usercontrol.

I put a radsplitter, 2 panes, and 2 placeholders in the usercontrol markup. I created a page with the usercontrol on it; within one of its templates I put a radgrid. Everything worked well with IE/FireFox, but the grid got squished in chrome. After searching these forums I found some javascripts which may be outdated, but I implemented them anways and the grid actually resized in chrome onload but gets squished the moment I start resizing the window.

Here's the code

usercontrol asxc
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="PanelView.ascx.cs" Inherits="PanelView" ClassName="PanelView" %> 
<%@ Register Src="HeaderBar.ascx" TagName="HeaderBar" TagPrefix="emesh" %> 
<telerik:RadScriptBlock ID="rsbChrome" runat="server" Visible="false"
    <script type="text/javascript"
            function Resize() { 
                setTimeout(function () { 
 
                    var scrollArea = null
 
                    for (var i = 0; i < radGrids.length; i++) { 
 
                        var scrollArea = document.getElementById(radGrids[i] + "_GridData"); 
                        if (scrollArea) { 
                            scrollArea.style.height = document.body.offsetHeight + "px"; 
                        } 
                        if (window[radGrids[i]].ClientSettings.Scrolling.UseStaticHeaders) { 
                            var header = document.getElementById(radGrids[i] + "_GridHeader"); 
                            scrollArea.style.height = document.body.offsetHeight - header.offsetHeight + "px"; 
                        } 
                    } 
                     
                }, 200); 
            } 
            windowwindow.onresize = window.onload = Resize
    </script> 
</telerik:RadScriptBlock> 
<telerik:RadSplitter ID="RadSplitter1" runat="server" Width="100%" BorderSize="0" BorderStyle="None" PanesBorderSize="0" Height="100%" Orientation="Horizontal"
    <telerik:RadPane ID="LeftPane" runat="server" Scrolling="None"
        <emesh:HeaderBar runat="server" ID="LeftPaneCaption" /> 
        <asp:PlaceHolder runat="server" ID="LeftPaneContent" /> 
    </telerik:RadPane> 
    <telerik:RadSplitBar ID="RadSplitBar1" runat="server"
    </telerik:RadSplitBar> 
    <telerik:RadPane ID="RightPane" runat="server" Scrolling="None"
        <emesh:HeaderBar runat="server" ID="RightPaneCaption" /> 
        <asp:PlaceHolder runat="server" ID="RightPaneContent" /> 
    </telerik:RadPane> 
</telerik:RadSplitter> 

usercontrol codebehind:
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using Telerik.Web.UI; 
using System.ComponentModel; 
using System.Web.Script.Serialization; 
 
public partial class PanelView : System.Web.UI.UserControl 
    #region ContentTemplate Code 
 
    private ITemplate leftContentTemplate = null
    private ITemplate rightContentTemplate = null
 
    public class ContentContainer : WebControl, INamingContainer { } 
 
    [TemplateContainer(typeof(ContentContainer))] 
    [PersistenceMode(PersistenceMode.InnerProperty)] 
    [TemplateInstance(TemplateInstance.Single)] 
    [Browsable(true)] 
    [Category("Behavior")] 
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] 
    public ITemplate LeftPaneContentTemplate 
    { 
        get { return leftContentTemplate; } 
        set { leftContentTemplate = value; } 
    } 
 
    [TemplateContainer(typeof(ContentContainer))] 
    [PersistenceMode(PersistenceMode.InnerProperty)] 
    [TemplateInstance(TemplateInstance.Single)] 
    [Browsable(true)] 
    [Category("Behavior")] 
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] 
    public ITemplate RightPaneContentTemplate 
    { 
        get { return rightContentTemplate; } 
        set { rightContentTemplate = value; } 
    } 
 
    protected override void OnInit(EventArgs e) 
    { 
        base.OnInit(e); 
 
        if (LeftPaneContentTemplate != null
        { 
            // Instantiate and initialize the content container class 
            ContentContainer containerLeft = new ContentContainer(); 
            LeftPaneContentTemplate.InstantiateIn(containerLeft); 
 
            // Add the content template to the placeholder so that we can see the user content 
            LeftPaneContent.Controls.Add(containerLeft); 
        } 
        else 
        { 
            LeftPaneVisible = false
        } 
 
        if (RightPaneContentTemplate != null
        { 
            // Instantiate and initialize the content container class 
            ContentContainer containerRight = new ContentContainer(); 
            RightPaneContentTemplate.InstantiateIn(containerRight); 
 
            // Add the content template to the placeholder so that we can see the user content 
            RightPaneContent.Controls.Add(containerRight); 
        } 
        else 
        { 
            RightPaneVisible = false
        } 
    } 
    #endregion 
    #region Properties 
 
    public bool LeftPaneVisible 
    { 
        getreturn LeftPane.Visible; } 
        set{ LeftPane.Visible = value;} 
    } 
    public bool RightPaneVisible 
    { 
        get { return RightPane.Visible; } 
        set { RightPane.Visible = value; } 
    } 
 
    public string LeftPaneTitle 
    { 
        get { return LeftPaneCaption.Text; } 
        set { LeftPaneCaption.Text = value; } 
    } 
    public string RightPaneTitle 
    { 
        get { return RightPaneCaption.Text; } 
        set { RightPaneCaption.Text = value; } 
    } 
 
    public Orientation CurrentOrientation 
    { 
        get { return RadSplitter1.Orientation; } 
        set { RadSplitter1.Orientation = value; } 
    } 
 
    public bool ChromeCompatibilityMode 
    { 
        get
        set
    } 
    #endregion 
 
    protected override void OnPreRender(EventArgs e) 
    { 
        base.OnPreRender(e); 
 
        if (!LeftPaneVisible || !RightPaneVisible) 
        { 
            RadSplitBar1.Visible = false
        } 
 
        if (ChromeCompatibilityMode) 
        { 
            rsbChrome.Visible = true
 
            List<string> IDs = new List<string>(); 
 
            FillWithGridIDs(IDs, Page.Controls); 
 
            JavaScriptSerializer js = new JavaScriptSerializer(); 
 
            ScriptManager.RegisterArrayDeclaration(Page, "radGrids", js.Serialize(IDs)); 
        } 
    } 
 
    protected void Page_Load(object sender, EventArgs e) 
    { 
 
    } 
 
    private void FillWithGridIDs(List<string> gridIDs, ControlCollection controls) 
    { 
        foreach (Control ctrl in controls) 
        { 
            if (ctrl is RadGrid) 
            { 
                gridIDs.Add(ctrl.ClientID); 
            } 
 
            FillWithGridIDs(gridIDs, ctrl.Controls); 
        } 
    } 

aspx:
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/EMeshMaster.master" AutoEventWireup="true" CodeFile="Roles.aspx.cs" Inherits="Roles" %> 
 
<%@ Register src="UserControls/HeaderBar.ascx" tagname="HeaderBar" tagprefix="uc1" %> 
<%@ Register src="UserControls/PanelView.ascx" tagname="PanelView" tagprefix="emesh" %> 
 
<asp:Content ID="Content1" ContentPlaceHolderID="cphHead" Runat="Server"
</asp:Content> 
 
<asp:Content ID="Content2" ContentPlaceHolderID="cphContent" Runat="Server"
 
    <asp:ObjectDataSource ID="dsRoles" runat="server" TypeName="DbHelpers" SelectMethod="GetRoles"></asp:ObjectDataSource> 
 
    <emesh:PanelView runat="server" ChromeCompatibilityMode="true"> 
        <LeftPaneContentTemplate> 
            <telerik:RadToolBar ID="tlbRoles" runat="server" Width="100%" onbuttonclick="tlbRoles_ButtonClick"
                <Items> 
                    <telerik:RadToolBarButton Value="tbWrapper"
                        <ItemTemplate> 
                            <table cellpadding="2" cellspacing="0"
                                <tr> 
                                    <td> 
                                        <span>New Role</span> 
                                    </td> 
                                    <td> 
                                        <telerik:RadTextBox runat="server" ID="tbRole"
                                        </telerik:RadTextBox> 
                                    </td> 
                                </tr> 
                            </table> 
                        </ItemTemplate> 
                    </telerik:RadToolBarButton> 
                    <telerik:RadToolBarButton Text="Create" Value="new"></telerik:RadToolBarButton> 
                    <telerik:RadToolBarButton IsSeparator="true"></telerik:RadToolBarButton> 
                    <telerik:RadToolBarButton Text="Delete Role" Value="delete"></telerik:RadToolBarButton> 
                </Items> 
            </telerik:RadToolBar> 
 
            <telerik:RadGrid ID="existingRoles" runat="server"  AllowSorting="True" AutoGenerateColumns="False" GridLines="None" Height="100%" Width="100%" DataSourceID="dsRoles" ShowHeader="True"
                <ClientSettings> 
                    <Selecting AllowRowSelect="True" /> 
                    <Scrolling AllowScroll="True"  /> 
                </ClientSettings> 
                 
                <MasterTableView> 
                    <RowIndicatorColumn> 
                        <HeaderStyle Width="20px"></HeaderStyle> 
                    </RowIndicatorColumn> 
                    <ExpandCollapseColumn> 
                        <HeaderStyle Width="20px"></HeaderStyle> 
                    </ExpandCollapseColumn> 
                    <Columns> 
                        <telerik:GridBoundColumn HeaderText="Roles" UniqueName="RoleName" DataField="RoleName"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn HeaderText="Users in Role" UniqueName="UsersInRole" DataField="UsersInRole"
                        </telerik:GridBoundColumn> 
                    </Columns> 
                </MasterTableView> 
            </telerik:RadGrid> 
 
        </LeftPaneContentTemplate> 
    </emesh:PanelView> 
</asp:Content> 
 
 

By the way: if I take the contents of the LeftPaneContentTemplate and just slap that into the aspx markup then the problem disappears, but then I can't use templated usercontrols. I do not use ajax or any updatepanels for this app (yet). As of this moment I will start moving the functionality from this usercontrol into a masterpage instead. Maybe I will have better luck there.

Any ideas ?

Edit: RadControls Version: v.2010.1.415.40
Dimo
Telerik team
 answered on 27 May 2010
3 answers
325 views
I am having a pretty big issue with the calendar control for my web site (http://www.rankingshq.com/public/eventcalendar.aspx).

So basically a visitor will navigate to a month and then click on the "Go" button which is meant to refresh the tournament calendar and filter by the month they have navigated to.

The issue is that the user will not select a specific day on the calendar. They only care about the month they have navigated to. So when I try to access the current month in the code behind I am unable to get the month they have navigated to, it keeps on referencing the month which has a selected day in it...I have pasted the lines of code that perform the filter below.

if (chkIncludeCalendar.Checked) 
        { 
            //DateTime selectedMonthStart = new DateTime(eventCalendar.CalendarView.ViewStartDate.Year, eventCalendar.SelectedDate.Month, 1); 
            filter.AddWithAnd(TournamentFields.StartDate >= eventCalendar.CalendarView.ViewStartDate); 
            filter.AddWithAnd(TournamentFields.StartDate <= eventCalendar.CalendarView.ViewEndDate); 
        } 

So if I want to reference the month that has been navigated to, is this possible without the user being forced to selected a specific day in that month?

Regards,
Andrew Galea
Mira
Telerik team
 answered on 27 May 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?