Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
88 views
HI,

I m using RadTabStrip contorls, I m using custum skin. i want  to change the font size and make it bold . I cant find the class to make the changes. i try to use custom class but its not working . Please help
Please find the screen shot attachment.


Farhan Hashmi
Prince
Top achievements
Rank 1
 asked on 18 May 2008
4 answers
178 views

I am creating a custom control to display an image based on a database field. If field=1, show image1, if field=2, show image2, etc.

The following error appears..."CS0103: The name 'SetPercentageCompleteImage' does not exist in the current context". It seems to me that the default.aspx page cannot see the SetPercentageComplete function in PercentComplete.ascx.cs so I think it is namespace problem. I have tried to configure a namespace but this just generated more errors.

The key elements of the user control and default page are listed below:

PercentComplete.ascx 

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

<asp:Image ID="Image1" runat="server" ImageUrl="~/0_Perc_Comp.png" OnLoad="SetPercentageCompleteImage" />

 

PercentComplete.ascx.cs  

using System;

using System.Collections;

using System.Configuration;

using System.Data;

using System.Linq;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.HtmlControls;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Xml.Linq;

public partial class PercentageCompleteImage : System.Web.UI.UserControl

{

protected void Page_Load(object sender, EventArgs e)            {        }

public String PerCentValue

           { get ;  set ;  }public void SetPercentageCompleteImage(object sender, EventArgs e)

{

int x = Convert.ToInt32(PerCentValue);

switch (x) {

case 0: Image1.ImageUrl = "~/0_Perc_Comp.png"; return;

case 1: Image1.ImageUrl = "~/10_Perc_Comp.png"; return;

case 2: Image1.ImageUrl = "~/20_Perc_Comp.png"; return;

case 3: Image1.ImageUrl = "~/30_Perc_Comp.png"; return;

}  }  }

 

Elements of Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register src="PercentageCompleteImage.ascx" tagprefix="uc1" tagname="PercentageCompleteImage" %>

<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>   .....using this for the RADGrid with control in a template

....

 

The template where the problem occurs. 

<telerik:GridTemplateColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" ForceExtractValue="None" UniqueName="column" HeaderText="Status">

    <EditItemTemplate>      <asp:TextBox runat="server"></asp:TextBox>    </EditItemTemplate>

    <ItemTemplate> <uc1:PercentageCompleteImage  ID="PercentageCompleteImage1" runat="server" PerCentValue='<%# SetPercentageCompleteImage(Eval("Status")) %>' />  </ItemTemplate>   .....this is the problem line (referencing the Status field which is a GridBoundColumn further up the page).

</telerik:GridTemplateColumn>

Thanks in advance

Brad
B
Top achievements
Rank 1
 answered on 18 May 2008
0 answers
127 views
Hi, I would like to connect my Web.sitemap to the treeview component and use custom attributes in my sitemap for the DataTextField and DataValueField, is this possible?

Using default attributes from Web.sitemap works fine, ex:
RadTreeView1.DataSource = SiteMapDataSource1;
RadTreeView1.DataTextField = "title";
RadTreeView1.DataValueField = "url";

How do I set the DataTextField to a custom attribute named "pageTitle"? I can't figure out how to get access to it.

Edit: I found the solution from a older version, just had to rewrite it a little. Here's the solution:
protected void RadTreeView1_NodeDataBound(object sender, RadTreeNodeEventArgs e)
    {
        SiteMapNode siteMapNode = (SiteMapNode)e.Node.DataItem;
        e.Node.Text = siteMapNode["pageTitle"];
    }
Jay
Top achievements
Rank 1
 asked on 18 May 2008
3 answers
158 views
 I was intending to use a mixture of controls from the ASP.NET Ajax Control Toolkit with RAD Control for ASP.Net Ajax.

Please could you advise on any compatability issues or things I should look out for when using controls from both sets of controls.

Thanks in advance

Mike
Baatezu
Top achievements
Rank 2
 answered on 18 May 2008
3 answers
201 views
Trying to implement a VB rendition of the multi-value resources example I'm getting error in my web.config.  Any ideas are appreciated.

web.config
    <configSections> 
        <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">  
            <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">  
                <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" /> 
                <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">  
                    <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere" /> 
                    <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" /> 
                    <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" /> 
                </sectionGroup> 
            </sectionGroup> 
        </sectionGroup> 
        <sectionGroup name="telerik.web.ui">  
            <section name="radScheduler" type="Telerik.Web.UI.RadSchedulerConfigurationSection, Telerik.Web.UI, PublicKeyToken=121fae78165ba3d4" allowDefinition="MachineToApplication" requirePermission="false" /> 
        </sectionGroup> 
    </configSections> 
 
...  
 
    <telerik.web.ui> 
        <radScheduler defaultAppointmentProvider="Integrated">  
            <appointmentProviders> 
                <add name="AppDbSchedulerProvider" 
                    connectionStringName="dbMemberConnString" 
                    type="AppScheduler.AppDbSchedulerProvider"   
                    persistChanges="true" /> 
            </appointmentProviders> 
        </radScheduler> 
    </telerik.web.ui> 

web.config error:
Parser Error Message: Cannot create an abstract class.

Source Error:

Line 202:				<add name="AppDbSchedulerProvider"
Line 203:					connectionStringName="dbMemberConnString"
Line 204: type="AppScheduler.AppDbSchedulerProvider" Line 205:					persistChanges="true" />
Line 206:			</appointmentProviders>

Provider code:

Imports System  
Imports System.Collections.Generic  
Imports System.Collections.Specialized  
Imports System.Configuration  
Imports System.Configuration.Provider  
Imports System.Data  
Imports System.Data.Common  
Imports System.Data.SqlClient  
Imports Telerik.Web.UI  
 
Namespace AppScheduler  
    Public MustInherit Class AppDbSchedulerProvider  
        Inherits DbSchedulerProviderBase  
        Public Overloads Overrides Function GetAppointments(ByVal owner As RadScheduler) As IEnumerable(Of Appointment)  
            Dim appointments As New List(Of Appointment)()  
 
            Using conn As DbConnection = OpenConnection()  
                Dim cmd As DbCommand = DbFactory.CreateCommand()  
                cmd.Connection = conn 
                cmd.CommandText = "SELECT [ClassID], [Subject], [Start], [End], [RecurrenceRule], [RecurrenceParentId] FROM [DbProvider_Classes]" 
 
                Using reader As DbDataReader = cmd.ExecuteReader()  
                    While reader.Read()  
                        Dim apt As New Appointment()  
                        apt.Owner = owner 
                        apt.ID = reader("ClassID")  
                        apt.Subject = Convert.ToString(reader("Subject"))  
                        apt.Start = DateTime.SpecifyKind(Convert.ToDateTime(reader("Start")), DateTimeKind.Utc)  
                        apt.[End] = DateTime.SpecifyKind(Convert.ToDateTime(reader("End")), DateTimeKind.Utc)  
                        apt.RecurrenceRule = Convert.ToString(reader("RecurrenceRule"))  
                        If Not apt.RecurrenceParentID Is Nothing Then  
                            apt.RecurrenceParentID = reader("RecurrenceParentId")  
                        End If  
 
                        If apt.RecurrenceParentID <> Nothing Then  
                            apt.RecurrenceState = RecurrenceState.Exception  
                        ElseIf apt.RecurrenceRule <> String.Empty Then  
                            apt.RecurrenceState = RecurrenceState.Master  
                        End If  
 
                        LoadResources(apt)  
                        appointments.Add(apt)  
                    End While  
                End Using  
            End Using  
 
            Return appointments  
        End Function  
 
        'Public Overrides Sub Delete(ByVal owner As Telerik.Web.UI.RadScheduler, ByVal appointmentToDelete As Telerik.Web.UI.Appointment)  
        Public Overrides Sub Delete(ByVal owner As RadScheduler, ByVal appointmentToDelete As Appointment)  
            If Not PersistChanges Then  
                Return  
            End If  
            Using conn As DbConnection = OpenConnection()  
                Dim cmd As DbCommand = DbFactory.CreateCommand()  
                cmd.Connection = conn 
                Using tran As DbTransaction = conn.BeginTransaction()  
                    cmd.Transaction = tran 
                    ClearClassStudents(appointmentToDelete.ID, cmd)  
                    cmd.Parameters.Clear()  
                    cmd.Parameters.Add(CreateParameter("@ClassID", appointmentToDelete.ID))  
                    cmd.CommandText = "DELETE FROM [DbProvider_Classes] WHERE [ClassID] = @ClassID" 
                    cmd.ExecuteNonQuery()  
                    tran.Commit()  
                End Using  
            End Using  
        End Sub  
 
        Private Sub FillClassStudents(ByVal appointment As Appointment, ByVal cmd As DbCommand, ByVal classId As Object)  
            For Each student As Resource In appointment.Resources.GetResourcesByType("Student")  
                cmd.Parameters.Clear()  
                cmd.Parameters.Add(CreateParameter("@ClassID", classId))  
                cmd.Parameters.Add(CreateParameter("@StudentID", student.Key))  
                cmd.CommandText = "INSERT INTO [DbProvider_ClassStudents] ([ClassID], [StudentID]) VALUES (@ClassID, @StudentID)" 
                cmd.ExecuteNonQuery()  
            Next  
        End Sub  
 
        Private Sub ClearClassStudents(ByVal classId As Object, ByVal cmd As DbCommand)  
            cmd.Parameters.Clear()  
            cmd.Parameters.Add(CreateParameter("@ClassID", classId))  
            cmd.CommandText = "DELETE FROM [DbProvider_ClassStudents] WHERE [ClassID] = @ClassID" 
            cmd.ExecuteNonQuery()  
        End Sub  
 
        Public Overrides Sub Insert(ByVal owner As RadScheduler, ByVal appointmentToInsert As Appointment)  
            If Not PersistChanges Then  
                Return  
            End If  
            Using conn As DbConnection = OpenConnection()  
                Using tran As DbTransaction = conn.BeginTransaction()  
                    Dim cmd As DbCommand = DbFactory.CreateCommand()  
                    cmd.Connection = conn 
                    cmd.Transaction = tran 
                    PopulateAppointmentParameters(cmd, appointmentToInsert)  
                    cmd.CommandText = " INSERT INTO [DbProvider_Classes]([Subject], [Start], [End], [TeacherID], [RecurrenceRule], [RecurrenceParentID]) VALUES (@Subject, @Start, @End, @TeacherID, @RecurrenceRule, @RecurrenceParentID)" 
                    If TypeOf DbFactory Is SqlClientFactory Then  
                        cmd.CommandText += Environment.NewLine + "SELECT SCOPE_IDENTITY()"  
                    Else  
                        cmd.ExecuteNonQuery()  
                        cmd.CommandText = "SELECT @@IDENTITY" 
                    End If  
                    Dim identity As Integer = Convert.ToInt32(cmd.ExecuteScalar())  
                    FillClassStudents(appointmentToInsert, cmd, identity)  
                    tran.Commit()  
                End Using  
            End Using  
        End Sub  
 
        Public Overrides Sub Update(ByVal owner As RadScheduler, ByVal appointmentToUpdate As Appointment)  
            If Not PersistChanges Then  
                Return  
            End If  
            Using conn As DbConnection = OpenConnection()  
                Using tran As DbTransaction = conn.BeginTransaction()  
                    Dim cmd As DbCommand = DbFactory.CreateCommand()  
                    cmd.Connection = conn 
                    cmd.Transaction = tran 
                    PopulateAppointmentParameters(cmd, appointmentToUpdate)  
                    cmd.Parameters.Add(CreateParameter("@ClassID", appointmentToUpdate.ID))  
                    cmd.CommandText = "UPDATE [DbProvider_Classes] SET [Subject] = @Subject, [Start] = @Start, [End] = @End, [TeacherID] = @TeacherID, [RecurrenceRule] = @RecurrenceRule, [RecurrenceParentID] = @RecurrenceParentID WHERE [ClassID] = @ClassID" 
                    cmd.ExecuteNonQuery()  
                    ClearClassStudents(appointmentToUpdate.ID, cmd)  
                    FillClassStudents(appointmentToUpdate, cmd, appointmentToUpdate.ID)  
                    tran.Commit()  
                End Using  
            End Using  
        End Sub  
 
        Public Overloads Overrides Function GetResourceTypes(ByVal owner As RadScheduler) As IEnumerable(Of ResourceType)  
            Dim resourceTypes As ResourceType() = New ResourceType(2) {}  
            resourceTypes(0) = New ResourceType("Teacher", False)  
            resourceTypes(1) = New ResourceType("Student", True)  
            Return resourceTypes  
        End Function  
 
        Private Sub LoadResources(ByVal apt As Appointment)  
            Using conn As DbConnection = OpenConnection()  
                Dim cmd As DbCommand = DbFactory.CreateCommand()  
                cmd.Connection = conn 
                cmd.Parameters.Add(CreateParameter("@ClassID", apt.ID))  
                cmd.CommandText = "SELECT [TeacherID] FROM [DbProvider_Classes] WHERE [ClassID] = @ClassID AND [TeacherID] IS NOT NULL" 
                Using reader As DbDataReader = cmd.ExecuteReader()  
                    If reader.Read() Then  
                        Dim teacher As Resource = apt.Owner.Resources.GetResource("Teacher", reader("TeacherID"))  
                        apt.Resources.Add(teacher)  
                    End If  
                End Using  
                cmd.Parameters.Clear()  
                cmd.Parameters.Add(CreateParameter("@ClassID", apt.ID))  
                cmd.CommandText = "SELECT [StudentID] FROM [DbProvider_ClassStudents] WHERE [ClassID] = @ClassID" 
                Using reader As DbDataReader = cmd.ExecuteReader()  
                    While reader.Read()  
                        Dim student As Resource = apt.Owner.Resources.GetResource("Student", reader("StudentID"))  
                        apt.Resources.Add(student)  
                    End While  
                End Using  
            End Using  
        End Sub  
 
        Public Overloads Overrides Function GetResourcesByType(ByVal owner As RadScheduler, ByVal resourceType As String) As IEnumerable(Of Resource)  
            Select Case resourceType  
                Case "Teacher"  
                    Return GetTeachers()  
                Case "Student"  
                    Return GetStudents()  
                Case Else  
                    Throw New InvalidOperationException("Unknown resource type: resourceType")  
            End Select  
        End Function  
 
        Private Function GetTeachers() As IEnumerable(Of Resource)  
            Dim resources As New List(Of Resource)()  
            Using conn As DbConnection = OpenConnection()  
                Dim cmd As DbCommand = DbFactory.CreateCommand()  
                cmd.Connection = conn 
                cmd.CommandText = "SELECT [TeacherID], [Name], [Phone] FROM [DbProvider_Teachers]" 
                Using reader As DbDataReader = cmd.ExecuteReader()  
                    While reader.Read()  
                        Dim res As New Resource()  
                        res.Type = "Teacher" 
                        res.Key = reader("TeacherID")  
                        res.Text = Convert.ToString(reader("Name"))  
                        res.Attributes("Phone") = Convert.ToString(reader("Phone"))  
                        resources.Add(res)  
                    End While  
                End Using  
            End Using  
            Return resources  
        End Function  
 
        Private Function GetStudents() As IEnumerable(Of Resource)  
            Dim resources As New List(Of Resource)()  
            Using conn As DbConnection = OpenConnection()  
                Dim cmd As DbCommand = DbFactory.CreateCommand()  
                cmd.Connection = conn 
                cmd.CommandText = "SELECT [StudentID], [Name] FROM [DbProvider_Students]" 
                Using reader As DbDataReader = cmd.ExecuteReader()  
                    While reader.Read()  
                        Dim res As New Resource()  
                        res.Type = "Student" 
                        res.Key = reader("StudentID")  
                        res.Text = Convert.ToString(reader("Name"))  
                        resources.Add(res)  
                    End While  
                End Using  
            End Using  
            Return resources  
        End Function  
 
        Private Sub PopulateAppointmentParameters(ByVal cmd As DbCommand, ByVal apt As Appointment)  
            cmd.Parameters.Add(CreateParameter("@Subject", apt.Subject))  
            cmd.Parameters.Add(CreateParameter("@Start", apt.Start))  
            cmd.Parameters.Add(CreateParameter("@End", apt.[End]))  
            Dim teacher As Resource = apt.Resources.GetResourceByType("Teacher")  
            Dim teacherId As Object = Nothing 
            If teacher <> Nothing Then  
                teacherteacherId = teacher.Key  
            End If  
            cmd.Parameters.Add(CreateParameter("@TeacherID", teacherId))  
            Dim rrule As String = Nothing 
            If apt.RecurrenceRule <> String.Empty Then  
                rrule = apt.RecurrenceRule  
            End If  
            cmd.Parameters.Add(CreateParameter("@RecurrenceRule", rrule))  
            Dim parentId As Object = Nothing 
            If apt.RecurrenceParentID <> Nothing Then  
                parentId = apt.RecurrenceParentID  
            End If  
            cmd.Parameters.Add(CreateParameter("@RecurrenceParentId", parentId))  
        End Sub  
 
 
    End Class  
End Namespace 

Thanks
jonnyO
Top achievements
Rank 1
 answered on 18 May 2008
5 answers
215 views
Hello everyone,
    I'm just wondering if it is possible to have a readonly & hidden column which can be accessed in the GridCommandEventArgs. The reason for this is that I have an identity in a table, which is the DataSource of the grid, which is not supposed to be editted, but I also need that value in order to update the records in the database.
    Also, I have a column for passwords, and am wondering if there is an option to mask the data, in a way such that the GridCommandEventArgs.Item will recognize the text behind the mask, rather than redeading the characters. Using the DataFormatString = "********", the values are always ******** rather than the actual text, which is not good enough for my purposes since the database would recognize this value as different from the stored password.

Thanks :)
Wes Cloven
Top achievements
Rank 2
 answered on 18 May 2008
6 answers
232 views
Is this possible? I have have disabled ajax on the call but still have UploadedFiles.Count = 0.

Is this because the usercontrol is being reloaded on each postback and if so is there a workaround?

Thanks,
Dave
Blaize
Top achievements
Rank 1
 answered on 17 May 2008
1 answer
118 views
Hello,

We are using RadScheduler (version 2008.1.515.20) and are also using RadTooltips in the scheduler to display event details for each of the appointments.

To show the event, we have the showevent property of the tooltipmanager set to OnRightClick, and this can not be changed since we are using click and double click for other actions.

The problem occurs in IE6, in that the right click to display the tooltip gets cancelled out by IE6's context menu popup.

Please advice if they is a workaround or soution for this without having to change the showevent action.

Thank you.
Peter
Telerik team
 answered on 17 May 2008
2 answers
130 views
I'm looking to implement a product display page. Do you have any controls similar to .NET's ListView or DevExpress's DataView control (http://demos.devexpress.com/ASPxperienceDemos/DataView/DataBinding.aspx)?
bemara57
Top achievements
Rank 1
 answered on 17 May 2008
1 answer
78 views
I am new to all of this and just downloaded the demo.  Using VS2008.  2 questions:  When I try to add the AJAX ASP.NET components to the toolbox all the telerik components are already checked but they do NOT show up on the toolbox.  Any idea why or how I can get around this?

Finally, when I create a new ASPX page, what is the basic process I have to follow to use the scheduler or any other tool?  Do I just have to...
1.  Add an asp:ScriptManager
2.  Add a Telerik:RadAjaxManager
3.  Add the tool

Is that it?  Thanks for your response!
Peter
Telerik team
 answered on 17 May 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?