Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
45 views
Hello, I am testing your components (ASP.AJAX) in order to find out if they are suited to my need for a project of mine. 

I have a software design issue:

In my web application, I populate a RadTreeView from a dataset, when I click on a node it should display the corresponding data. My problem is that the data are different for some nodes. There are two cases, either I need to load a static web page to a container in my site, or to display some databinded controls. The databinded controls are different and they depend on the kind of the node clicked. I have all the necessary info available, but I am not sure what object to use as a container and how to add the databinded controlls.

What I 'm thinking of doing is to have an RadXMLhttpPanel in which I can load a static page by placing it in a <Div runat="server"> using the innerHTML method (i read the static page as text using the HttpRequest object of .net).
Now regarding the databinded controls, I would prefer to have them grouped somewhere (preferably to an external entity like an .aspx page, but I believe that if i use the above mechanism to load the page with the controls then it would be difficult to do the data binding). 

My other option is to have more that one RadXMLHttpPanels (one for external pages, and one for each set of databinded controlls) and each time to hide all except the one i need. 

Do you have in mind any other (better) way to do this ? 

Thank you for your time,
Thomas Sarmis.
Thomas
Top achievements
Rank 1
 answered on 03 Dec 2010
1 answer
163 views
Dear Telerik,

I have created a template inside listBox like your example in the demo: http://demos.telerik.com/aspnet-ajax/listbox/examples/functionality/templates/defaultcs.aspx

but I don't want to create a static data, so I have created a list like the followin:
      public class Spinning
    {
        public string Title { get; set; }
        public double Price { get; set; }
        public int Quantity { get; set; }
    }
  
    void RadListBox5_Load()
    {
        List<Spinning> SpinningList = new List<Spinning> 
        
            new Spinning { Title = "Spinning Reel 1", Price = 99, Quantity = 1 },
            new Spinning { Title = "Spinning Reel 2", Price = 199, Quantity = 1 }
        };
  
        RadListBox5.DataSource = SpinningList;
        RadListBox5.DataBind();
    }
and the the aspx like the following:
<telerik:RadListBox ID="RadListBox5" runat="server" AllowTransfer="true" 
            AutoPostBackOnTransfer="true" Height="200px" OnTransferred="RadListBox5_Transferred" 
            SelectionMode="Multiple" TransferToID="RadListBox6" Width="215px">
            <ButtonSettings ShowTransferAll="false" VerticalAlign="Middle" />
            <ItemTemplate>
              
                <table cellpadding="1" cellspacing="0" border="0">
                    <tr>
                        <td><b><%# DataBinder.Eval(Container, "Attributes['Title']")%></b></td>
                        <td> [Price:</td>
                        <td><%# Convert.ToInt32(DataBinder.Eval(Container, "Attributes['Price']")).ToString("C0") %>]</td>
                    </tr>
                </table>
            </ItemTemplate>
        </telerik:RadListBox>

the data are not displayed !!!!!
can you help me on this?

thanks,
Mohamed Taraman
Princy
Top achievements
Rank 2
 answered on 03 Dec 2010
1 answer
466 views
Hi

I am currently trying to use a custom filter on a GridTemplateColumn based on this example http://www.telerik.com/help/aspnet-ajax/grdimplementingfilteringfortemplatecolumns.html.

This works as expected but I lose designer support in visual studio and get the following error.
Telerik.Web.UI.GridColumnCollection must have items of type 'Telerik.Web.UI.GridColumn'. 'custom:TelerikFilterColumns' is of type 'RiskRegister.CustomFilterColumns.TelerikFilterColumns'.

Can anyone shed any light on this problem. I am using version 2009.2.701.20.

Thanks

My code follows

Filter class
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.Data;
 
namespace WebApplication2
{
    public class Filter : GridTemplateColumn
    {
        protected override void SetupFilterControls(TableCell cell)
        {
            RadComboBox filterCombo = new RadComboBox();
            filterCombo.AutoPostBack = true;
            filterCombo.DataTextField = this.DataField;
            filterCombo.DataValueField = this.DataField;
            filterCombo.SelectedIndexChanged +=
                new RadComboBoxSelectedIndexChangedEventHandler(filterCombo_SelectedIndexChanged);
 
            DataTable dt = new DataTable();
            dt.Columns.Add("ID", typeof(int));
            dt.Columns.Add("Value", typeof(string));
 
            DataRow row = dt.NewRow();
            row["ID"] = 0;
            row["Value"] = 0;
 
            dt.Rows.Add(row);
 
            filterCombo.DataSource = dt;
            filterCombo.Width = this.FilterControlWidth;
            filterCombo.NoWrap = false;
            filterCombo.EmptyMessage = "No Filter";
            cell.Controls.Add(filterCombo);
        }
 
        private void filterCombo_SelectedIndexChanged(object sender,
            RadComboBoxSelectedIndexChangedEventArgs e)
        {
            ((GridFilteringItem)(((RadComboBox)sender).Parent.Parent)).FireCommandEvent("Filter", new Pair());
        }
 
        protected override void SetCurrentFilterValueToControl(TableCell cell)
        {
            base.SetCurrentFilterValueToControl(cell);
            if (!(this.CurrentFilterValue == ""))
            {
                ((RadComboBox)cell.Controls[0]).Items.FindItemByText(this.CurrentFilterValue).Selected = true;
            }
        }
 
        protected override string GetCurrentFilterValueFromControl(TableCell cell)
        {
            string currentValue = ((RadComboBox)cell.Controls[0]).SelectedItem.Value;
            this.CurrentFilterFunction = (currentValue != "") ? GridKnownFunction.EqualTo : GridKnownFunction.NoFilter;
            return currentValue;
        }
    }
}

Markup
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs"
    Inherits="WebApplication2.WebUserControl1" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="WebApplication2" Namespace="WebApplication2" TagPrefix="custom" %>
<telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource">
    <MasterTableView DataKeyNames="ID" AutoGenerateColumns="false" AllowFilteringByColumn="True">
        <Columns>
            <custom:Filter DataField="Value" HeaderText="Val">  
            <ItemTemplate>
                        <asp:Label runat="server" ID="lblRiskArea" Text='<%# Bind("Value")%>' />
                    </ItemTemplate>                             
            </custom:Filter>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

Code behind
using System;
using System.Data;
 
namespace WebApplication2
{
    public partial class WebUserControl1 : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
 
        }
 
        protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("ID",typeof(int));
            dt.Columns.Add("Value",typeof(string));
 
            DataRow row = dt.NewRow();
            row["ID"] = 0;
            row["Value"] = 0;
 
            dt.Rows.Add(row);           
 
            RadGrid1.DataSource = dt;
        }
    }
}
Mike Beaton
Top achievements
Rank 1
 answered on 03 Dec 2010
1 answer
69 views
Hi,

Trying to setup the scheduler for dates on a table setup with IDs and Moving them. Got it to load but cant edit anything. Here is my code

<form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <%--Needed for JavaScript IntelliSense in VS2010--%>
            <%--For VS2008 replace RadScriptManager with ScriptManager--%>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </telerik:RadScriptManager>
    <script type="text/javascript">
        //Put your JavaScript code here.
    </script>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <div>
    </div>
    <telerik:RadScheduler ID="RadScheduler1" runat="server" DataEndField="RotationStart"
        DataKeyField="ScheduleID" DataSourceID="SchedulerDataSource" DataStartField="RotationStart"
        DataSubjectField="FullName" AllowInsert="False" GroupBy="ServiceName" 
        GroupingDirection="Vertical" Height="600px" SelectedDate="2010-06-28" 
        SelectedView="TimelineView" Skin="Black">
        <ResourceTypes>
            <telerik:ResourceType DataSourceID="ServiceDataSource" 
                ForeignKeyField="ServiceID" KeyField="ServiceID" Name="ServiceName" 
                TextField="ServiceName" />
        </ResourceTypes>
        <TimelineView NumberOfSlots="8" SlotDuration="7.00:00:00" />
    </telerik:RadScheduler>
    <asp:SqlDataSource ID="SchedulerDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ScheduleEvaluateConnectionString %>"
        DeleteCommand="DELETE FROM Schedule WHERE (ScheduleID = @ScheduleID)" InsertCommand="INSERT INTO Schedule(StudentID, ServiceID, RotationID) VALUES (@StudentID, @ServiceID, @RotationID)"
        SelectCommand="SELECT Schedule.ScheduleID, Schedule.StudentID, Schedule.ServiceID, Schedule.RotationID, Rotation.RotationNumber, Rotation.RotationWeek, Rotation.RotationStart, Rotation.RotationEnd, Service.ServiceName, Service.ServiceMax, Student.FullName FROM Rotation INNER JOIN Schedule ON Rotation.RotationID = Schedule.RotationID INNER JOIN Service ON Schedule.ServiceID = Service.ServiceID INNER JOIN Student ON Schedule.StudentID = Student.StudentID"
        UpdateCommand="UPDATE    Schedule
SET              StudentID = @StudentID, ServiceID = @ServiceID, RotationID =
                          (SELECT     RotationID
                            FROM          Rotation
                            WHERE      (RotationStart = @StartDate))
WHERE     (ScheduleID = @ScheduleID)">
        <DeleteParameters>
            <asp:Parameter Name="ScheduleID" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="StudentID" />
            <asp:Parameter Name="ServiceID" />
            <asp:Parameter Name="RotationID" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="StudentID" />
            <asp:Parameter Name="ServiceID" />
            <asp:Parameter Name="StartDate" />
            <asp:Parameter Name="ScheduleID" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="ServiceDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ScheduleEvaluateConnectionString %>"
        SelectCommand="SELECT [ServiceID], [ServiceName] FROM [Service] ORDER BY [ServiceName]">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="StudentDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ScheduleEvaluateConnectionString %>"
        SelectCommand="SELECT [StudentID], [FullName] FROM [Student] ORDER BY [FullName]">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="RotationDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ScheduleEvaluateConnectionString %>"
        SelectCommand="SELECT [RotationID], [RotationStart] FROM [Rotation] ORDER BY [RotationStart]">
    </asp:SqlDataSource>
    </form>

My Update command works in the query Builder when i plug in the correct id's an dates but unfortunately i get an error when i try timeline drag and drop changing.

Item has already been added. Key in dictionary: 'RotationStart'  Key being added: 'RotationStart'

Peter
Telerik team
 answered on 03 Dec 2010
1 answer
127 views
Hi,

I am trying to customize the CSS classes availalble on both the Image Properties Dialog and the Hyperlink Manager.
I've tried following the instructions here:
http://www.telerik.com/help/aspnet-ajax/cssstyles.html

By adding:
<CssClasses>
       
<telerik:EditorCssClass Name="Clear Class" Value="" />
       
<telerik:EditorCssClass Name="link" Value="a.link" />
       
<telerik:EditorCssClass Name="img" Value=".img" />
       
<telerik:EditorCssClass Name="redtext" Value=".redtext" />
   
</CssClasses>

But the CSS Class drop down is blank in both the image properties dialog and the Hyperlink manager.
Dobromir
Telerik team
 answered on 03 Dec 2010
2 answers
42 views
Dear Telerik support,

I have a datatable with 2 fields (Vessel, Totals) and 150 rows.
I want to use Bar Char type in horizontal orientation. The rows are to many so i need to use scrollbars.
The following properties are changed:
EnableAxisMarkers: False
EnableZoom: False
ScrollMode: XOnly
XScale: 5
XScrollOffset: 0

The chart is taking to long, in order to show the bars, in every scroll page (about 20-30 sec).
Is there anything wrong with the control, or am i doing something wrong?
Or is there any way to set the height of chart according the rows of the datatable? (example: 3 rows, height=200. 150 rows, height = 1000).

Below is the code, that i use to get the data from a SQL Store Procedure:

Protected Sub btnShowChart_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnShowChart.Click
 
     chTotal.DataSource = GetChartData()
     chTotal.DataBind()
 
 End Sub
 
 
 Private Function GetChartData() As DataTable
 
     Dim pCustomerID As New SqlClient.SqlParameter("@CustomerID", 8)
     Dim pFromPeriodID As New SqlClient.SqlParameter("@FromPeriodID", 8)
     Dim pToPeriodID As New SqlClient.SqlParameter("@ToPeriodID", 8)
     Dim pHasPPCTotals As New SqlClient.SqlParameter("@HasPPCTotals", SqlDbType.TinyInt)
 
     pCustomerID.Value = Session("CustomerID")
 
     If cbPPCTotal.Checked = True Then
         pHasPPCTotals.Value = 1
     Else
         pHasPPCTotals.Value = 0
     End If
     pFromPeriodID.Value = cbDateFromChart.SelectedValue
     pToPeriodID.Value = cbDateUntilChart.SelectedValue
 
     Dim tblResults As DataTable = ExecuteDataTable(ConnectionStrings.BilConnString, "GetCustomerSpendVessel", New Object() {pCustomerID, pFromPeriodID, pToPeriodID, pHasPPCTotals})
 
     chTotal.Series(0).DataYColumn = "Total"
     chTotal.PlotArea.XAxis.DataLabelsColumn = "Vessel"
     chTotal.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 0
     chTotal.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Color = System.Drawing.Color.DarkBlue
     chTotal.PlotArea.Appearance.Dimensions.Margins.Bottom = Telerik.Charting.Styles.Unit.Percentage(12)
 
     GetChartData = tblResults
 
 End Function


I Use:
VS ASP.NET 2008 (VB)
ASP.NET AJAX v.2010.3.1109.35 Trial

Thank you in advance for your time.

Best Regards,
Navarino Technology Department.
Technology
Top achievements
Rank 1
 answered on 03 Dec 2010
5 answers
132 views
Hi,

I have a problem with my RadGrid. I have a simple RadGrid that is bound to a StoreProcedure this SP takes 4 arguments all of them can be null.

I have bound the DataScourse Select to 4 controls (4 textboxes). The thought here is that the user will enter values into the textboxes and then he press a "search" button and the grid shows the data that the SP gets.

An example would be that the user inputs
1 in the 1st box
nothing in the 2nd box
3 in the 3rd box
nothing in the 4th box

In this case I want it to run the SP with the values (1,null,3,null)
This is all very simple and when I test it in the "ConfigureDataSource"-tutorial that the RadGrid has and I test the query it all works great, I do the same inputs leave 2 and 4 with nothing and inputs 1 and 3 in the others.
But when I then try this "live" it doesn't work, the grid doesn't even load up and give no records nothing happends.

The only thing that I can think of since I've been working with SP before is that I can't simply use a empty textbox or a null i need to use a DBNull.value otherwise the SP won't work. So how can I send in DBNull.value to the SP?

I've tried some things like
BoxNumber.Text = DBNull.value
(BoxNumber is the name of one of the textboxes), but it still doesn't work.

The "search" button simply does a

RadGrid1.DataBind();

And since its bound to the controls I would hope that a empty control would give null, but it doesn't. It seems like a very simply and small problem yet I have been stuck with it for a long time now, please help me out.

Thanks in advance.
Radoslav
Telerik team
 answered on 03 Dec 2010
5 answers
155 views
I am creating a RadGrid programmatically. It has 2 template columns as well.
When we click Edit button for a row then, one template column has to be changed to a dropdown and other column should be changed to RadListbox of checkboxes.

Also, the ItemTemplate value should be used to select the appropriate checkboxes ni the RadListBox.

I have written the code to select the ListBoxItems of RadListBox, but it doesn't work. Can some help.

The code I have written is of this way:-


In RadGrid's Item Data Bound event:-

GridDataItem gridDataItem = e.Item as GridDataItem;
            DataRowView dvRow = gridDataItem.DataItem as DataRowView;
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
     {
         GridDataItem gridDataItem = e.Item as GridDataItem;
         DataRowView dvRow = gridDataItem.DataItem as DataRowView;
 
         RadComboBox cmbPositionID = gridDataItem.FindControl("comboPositionID") as RadComboBox;
 
         cmbPositionID.SelectedValue = dvRow["PositionID"].ToString();
 
         RadListBox listBox = gridDataItem.FindControl("comboLanguageID") as RadListBox;
 
         string value = dvRow["LanguageID"].ToString();
 
         string[] values = value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
         foreach (string val in values)
         {
             RadListBoxItem item = listBox.FindItemByText(val);
             if (item != null)
                 item.Selected = true;
         }
 
       
     }




lic partial class Default : System.Web.UI.Page
{
    DataTable _userDT = new DataTable();
    DataTable _positionDT = new DataTable();
    DataTable _languageDT = new DataTable();

    RadGrid RadGrid1 = null;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            RadGrid1.DataBind(); 
    }

public partial class Default : System.Web.UI.Page
{
    DataTable _userDT = new DataTable();
    DataTable _positionDT = new DataTable();
    DataTable _languageDT = new DataTable();

    RadGrid RadGrid1 = null;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            RadGrid1.DataBind();
        }
    }

public partial class Default : System.Web.UI.Page
{
    DataTable _userDT = new DataTable();
    DataTable _positionDT = new DataTable();
    DataTable _languageDT = new DataTable();

  sdfasdfsadf  RadGrid RadGrid1 = null;
public partial class Default : System.Web.UI.Page
{
    DataTable _userDT = new DataTable();
    DataTable _positionDT = new DataTable();
    DataTable _languageDT = new DataTable();

    RadGrid RadGrid1 = null;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            RadGrid1.DataBind();
        }
    }
public partial class Default : System.Web.UI.Page
{
    DataTable _userDT = new DataTable();
    DataTable _positionDT = new DataTable();
asdfasdfdsafsa
    RadGrid RadGrid1 = null;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
  asdf          RadGrid1.DataBind();
        }
    }
    {
        if (!IsPostBack)
        {
 sadfRadGrid1.DataBind();
        }
sdaf
Iana Tsolova
Telerik team
 answered on 03 Dec 2010
3 answers
434 views
Hi,
I went through one problem In radCombobox,I have tables in which I am saving HTML tag text like <I>Test</I>,So when this text binded on RadCombobox then Selected Text display with HTML Tags But I want that I should render HTML automatically and display the text in italic mode,We tried one solutions where we used Itema Templated inside radcombobox its seems to work that time when I Open the combobox that time all html tags get render but when I close combobox then seletedt item display with HTML tags,Please tell me how to solve this?Your help will be highly appreciated.
Kalina
Telerik team
 answered on 03 Dec 2010
1 answer
83 views
Good afternoon,

I have an appointment and I put it on a radScheduler to use  ExportToICalendar method to export it to iCalendar format and I want to select the All day event "Checkbox" on MSOutlook. How I do that? 

Best Regards,

Frederico Fernandes
Peter
Telerik team
 answered on 03 Dec 2010
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?