Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
214 views
I have a RadGrid in which I am using GridClientSelectColumn. This column always appears as checkbox no matter what I set in its ButtonType property. How can I change the look of the column to PushButton or LinkButton. I am using 2009 Q1 controls for ASPNET AJAX.

-Manjeet
PPSDevs
Top achievements
Rank 1
 answered on 03 Dec 2009
2 answers
164 views
Hi there,

Is there a way to access a particular cell (TD) in radGrid throught javascript?
I need to access the cell, not the content of the cell. I.e I want to change the cell background css etc.
I used to access a normal TD in a table using document.getElementById.
But I noticed radGrid doesn't generate the ID for each cell (TD).
Or maybe I missed something, is there a away to display the ClientID of the Cell / Column for radGrid?

Thanks,

Sxin
First
Top achievements
Rank 1
 answered on 03 Dec 2009
5 answers
196 views

Hi All,

I have this problem with the grid on IE8 when UseStaticHeaders, AllowScroll and AllowFilteringByColumn are set to true. It causes the filter fields to be offset to the right when using the Internal Build 1129.35. I don't know if its occurring in earlier builds. It does not occur under IE8 compatibility mode.

 <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="test.aspx.vb" Inherits="SelfService.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>  
</head> 
<body> 
    <form id="form1" runat="server">  
    <asp:ScriptManager ID="sc1" runat="server">  
    </asp:ScriptManager> 
    <div> 
      
        <telerik:RadGrid ID="gridSearchGroup" runat="server" AutoGenerateColumns="false" Width="100%" EnableLinqExpressions="false" AllowFilteringByColumn="true">  
            <ClientSettings> 
                <Scrolling AllowScroll="true"  UseStaticHeaders="true"></Scrolling> 
                 
            </ClientSettings> 
            <MasterTableView  Width="100%" > 
                <Columns> 
                    <telerik:GridBoundColumn HeaderText="Group Name" DataField="Name"  AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn HeaderText="Description" DataField="Description" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">  
                    </telerik:GridBoundColumn> 
                </Columns> 
            </MasterTableView> 
        </telerik:RadGrid> 
    </div> 
    </form> 
</body> 
</html> 

Public Partial Class test  
    Inherits System.Web.UI.Page  
 
    Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load  
 
 
        gridSearchGroup.DataSource = New Object() {}  
        gridSearchGroup.DataBind()  
 
 
    End Sub 
 
End Class 



Dimo
Telerik team
 answered on 03 Dec 2009
1 answer
95 views
I'm using custom variables in my links (as #NAME#, #EMAIL#, #ZIP#, etc.), but the last # is not included (snap01.png). I fix this using Hyperlink Manager Dialog, but when return to editor, and change to HTML view, the symbol # dissapear again.

Thanks for your help.
Rumen
Telerik team
 answered on 03 Dec 2009
1 answer
206 views
Hello,

I am having problems with the RadScheduler!  I can drag appointments around and they are saved properly to the database, I am using code behind to a sql table adapter for the update.  I can drag items from a grid onto the scheduler with no problems.  However when I try to edit an appointment I get the following error:

Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occured while processing the request on the server. The status code returned from the server was: 500

Once the edit window comes up I can not update or cancel without getting this error.  I thought it was my database parameters so I tried to trap the call to the sql adapter using my own adapter, but it never even hits the adapter.  I tried profiling sql but it never calls into the database.  I tried the AppointmentCommand, AppointmentUpdate, and AppointmentCanceling triggers, but they don't seem to fire.

Can anyone give me an idea as to where to start looking for the problem?

Here is the code for my scheduler

<telerik:RadScheduler ID="SchedMaint" runat="server" DataEndField="End"   
                    DataKeyField="ID" DataSourceID="objSched" DataStartField="Start"   
                    DataSubjectField="Subject" SelectedView="WeekView"   
                    onappointmentcreated="SchedMaint_AppointmentCreated"   
                    CustomAttributeNames="CompletedDate,MaintSchedType"   
                    onappointmentcommand="SchedMaint_AppointmentCommand"   
                    onappointmentupdate="SchedMaint_AppointmentUpdate" onappointmentcancelingedit="SchedMaint_AppointmentCancelingEdit"   
                   > 
                      
                    <TimeSlotContextMenuSettings EnableDefault="false" /> 
                    <TimeSlotContextMenus> 
                    </TimeSlotContextMenus> 
                      
                    <AppointmentContextMenuSettings EnableDefault="false" /> 
                    <AppointmentContextMenus> 
                        <telerik:RadSchedulerContextMenu runat="server" ID="maintSchedApptContextMenu">  
                            <Items> 
                                <telerik:RadMenuItem Text="Edit" Value="CommandEdit" /> 
                                <telerik:RadMenuItem Text="Print" Value="Print" onclick="alert('bob')" /> 
                            </Items> 
                        </telerik:RadSchedulerContextMenu> 
                    </AppointmentContextMenus> 
                      
 
                     
                    <AdvancedForm Enabled="True" /> 
                      
 
                     
                </telerik:RadScheduler> 


Thanks,

Tom

Tom
Top achievements
Rank 1
 answered on 03 Dec 2009
1 answer
157 views
Hi I have this radgrid showing 10 items per page where I want to have a column with checkboxes.
When I check some checkboxes on page 1, I want to go to page 4 and select some more checkboxes.
And then go back to page 1 and the selected checkboxes should still be selected.
I have this working.

Now I want a select all checkbox which selects, well.... All records... I got it so far so it will select all records on the current page, but not on the other pages.

I've set it up like this:

<telerik:radgrid id="RadUsers" allowmultirowselection="true" showfooter="True" runat="server" showstatusbar="True" onneeddatasource="RadUsers_NeedDataSource" gridlines="None" allowpaging="True" pagesize="10" skin="Vista" allowfilteringbycolumn="True" autogeneratecolumns="False" >
    <mastertableview showfooter="True" datakeynames="UserID"  >
        <columns>
            <telerik:gridtemplatecolumn allowfiltering="false">
                <headertemplate>
                    <asp:checkbox id="headerChkbox" oncheckedchanged="ToggleSelectedState" autopostback="True" runat="server"></asp:checkbox>
                </headertemplate>
                <itemtemplate>
                    <asp:checkbox id="cbChecked" runat="server" autopostback="true" oncheckedchanged="OnCheckedChangedEvent" />
                </itemtemplate>
            </telerik:gridtemplatecolumn>
...

And:

        Private ReadOnly Property UsersChecked() As Hashtable
            Get
                Dim res As Object = ViewState("_cc")
                If (res Is Nothing) Then
                    res = New Hashtable
                    ViewState("_cc") = res
                End If
                Return CType(res, Hashtable)
            End Get
        End Property

....

        Protected Sub RadUsers_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadUsers.ItemDataBound
            If TypeOf e.Item Is GridDataItem Then
                Dim item As GridDataItem = CType(e.Item, GridDataItem)
                Dim box As CheckBox = CType(item.FindControl("cbChecked"), CheckBox)
                Dim isChecked As Object = Nothing

                isChecked = UsersChecked(item("UserID").Text)

                If Not (isChecked Is Nothing) Then
                    box.Checked = CType(isChecked, Boolean) = True
                End If
            End If
        End Sub


        Protected Sub ToggleSelectedState(ByVal sender As Object, ByVal e As EventArgs)
            Dim target As Hashtable = Nothing
            target = UsersChecked

            If (CType(sender, CheckBox)).Checked Then
                For Each dataItem As GridDataItem In RadUsers.MasterTableView.Items
                    CType(dataItem.FindControl("cbChecked"), CheckBox).Checked = True
                    'dataItem.Selected = True
                    target(dataItem("UserID").Text) = True
                Next
            Else
                For Each dataItem As GridDataItem In RadUsers.MasterTableView.Items
                    CType(dataItem.FindControl("cbChecked"), CheckBox).Checked = False
                    'dataItem.Selected = False
                    target(dataItem("UserID").Text) = Nothing
                Next
            End If
        End Sub


        Sub OnCheckedChangedEvent(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim box As CheckBox = CType(sender, CheckBox)
            Dim item As GridDataItem = CType(box.NamingContainer, GridDataItem)
            Dim target As Hashtable = Nothing

            target = UsersChecked

            If box.Checked Then
                target(item("UserID").Text) = True
            Else
                target(item("UserID").Text) = Nothing
            End If
        End Sub




Sebastian
Telerik team
 answered on 03 Dec 2009
2 answers
133 views
I have a grid that has a nested view.  When the parent is expanded depending on the user type I want to hide a column.  I know how to do this for the master table.

RadGrid1.MasterTableView.RenderColumns[10].Display = false

but RadGrid2 is a NestedViewTemplate.  When ever I attempt to reference RadGrid2 it tells me it does not exist in current context.  I am assuming I still need to do this in the RadGrid2_PreRender event.
Eric Klein
Top achievements
Rank 1
 answered on 03 Dec 2009
2 answers
151 views
I have a two date pickers on a page. They allow the user to select a from and to date. My page then queries a database and returns all entries within that date range. The page is working fine when you select the date for the first time. However if you change anything and try to submit again the date stays the same as the first time that you picked. Does anyone have any idea why. You can see it here alpha.clickablecommunity.com/printSelect.aspx

Here is my aspx
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/MasterPage.Master"
    CodeBehind="printSelect.aspx.vb" Inherits="ClickableCommunity.printSelect" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="headerContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="viewMenuContent" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="leftMenu" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="mainContentPlaceHolder" runat="server">
    <telerik:RadFormDecorator ID="formSkin" runat="server" Skin="Web20" DecoratedControls="Buttons" />
    <div style="padding-top: 20px; padding-left: 20px;">
        <h3>Print Events</h3>        
        <table cellpadding="5">
            <tr>
                <td>
                    From:
                    </td>
                    <td>
                    <telerik:RadDatePicker ID="startDate" runat="server" Skin="Web20">
                    </telerik:RadDatePicker>
                    <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator1" ControlToValidate="startDate"
                        ErrorMessage="Please enter a start date." CssClass="errorMessage" Display="Dynamic"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>
                    To:
                </td>
                <td>
                    <telerik:RadDatePicker ID="finishDate" runat="server" Skin="Web20">
                    </telerik:RadDatePicker>
                    <asp:RequiredFieldValidator runat="server" ID="Requiredfieldvalidator2" ControlToValidate="finishDate"
                        ErrorMessage="Please select an end date." Display="Dynamic"></asp:RequiredFieldValidator>
                    <asp:CompareValidator ID="dateCompareValidator" runat="server" ControlToValidate="finishDate"
                        ControlToCompare="startDate" Operator="GreaterThan" Type="String" ErrorMessage="The end date must be later than the start date."
                        CssClass="errorMessage" Display="Dynamic">
                    </asp:CompareValidator>
                </td>
            </tr>
        </table>

        <asp:Button ID="print" Text="Print" runat="server" />
    </div>
    <asp:Label ID="output" runat="server"></asp:Label>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="footerContent" runat="server">
</asp:Content>

And here is my vb
Imports Telerik.Web.UI
Imports System.Data
Imports System.Data.Sql
Imports System.Data.SqlClient

Partial Public Class printSelect
    Inherits System.Web.UI.Page

    'my sql connection string
    Dim conn As String = System.Configuration.ConfigurationManager.ConnectionStrings("connectionString").ToString

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not (Page.IsPostBack) Then
            startDate.SelectedDate = Date.Now
        End If
    End Sub

    Private Sub print_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles print.Click

        Dim beginDate As Date = startDate.DbSelectedDate
        Dim stopDate As Date = finishDate.DbSelectedDate
        Dim html As String

        'my sql connection
        Dim myConn As New Data.SqlClient.SqlConnection(conn)

        'the name of the stored procedure
        Dim strSQL = "getEventsInRange"

        Dim returnCommand As New Data.SqlClient.SqlCommand(strSQL, myConn)

        'add the parameters
        returnCommand.Parameters.AddWithValue("@start", beginDate)
        returnCommand.Parameters.AddWithValue("@stop", stopDate)

        'tell the system it is a stored procedure
        returnCommand.CommandType = CommandType.StoredProcedure

        Try
            myConn.Open()
            Dim dr As SqlDataReader = returnCommand.ExecuteReader()

            html = "<table cellpadding='3' border='0'><tr><td>" & beginDate.ToString & " test " & stopDate.ToString & "</td><td></td></tr>"

            While dr.Read()
                '0 events.name, 1 description, 2 businesses.name,
                '3 starttime, 4 stoptime, 5 locations.street, 6 locations.city, 7 locations.state,
                '8 locations.zip, 9 categories.name, 10businesses.website
                html &= "<tr><td><h3>" & dr.Item(0) & "</h3></td></td></tr>" & _
                        "<tr><td>Start: </td><td>" & dr.Item(3) & "</td></tr>" & _
                        "<tr><td>Stop: </td><td>" & dr.Item(4) & "</td></tr>" & _
                        "<tr><td>Location: </td><td>" & dr.Item(2) & "</td></tr>" & _
                        "<tr><td>Address: </td><td>" & dr.Item(5) & " " & dr.Item(6) & ", " & dr.Item(7) & " " & dr.Item(8) & "</td></tr>" & _
                        "<tr><td>Website: </td><td>" & dr.Item(10) & "</td></tr>" & _
                        "<tr><td>Description: </td><td>" & dr.Item(1) & "</td></tr>" & _
                        "<tr><td>Category: </td><td>" & dr.Item(9) & "</td></tr>"


            End While 'while dr.read()
            html += "</table>"
        Catch ex As Exception
            output.Text = ex.ToString

            'output.Text = ("<span class='textRed'>There was an error in retrieving the entity information,<br>" & _
            '               " please contact the system administrator if the problem persists.</span>")

        End Try
        If (output.Text = "") Then
            output.Text = html & "test"
        End If
    End Sub
End Class



Web Services
Top achievements
Rank 2
 answered on 03 Dec 2009
1 answer
158 views
Hi,

I have created a web part (which is in fact a smart part where the webpart will load a user control) for a sharepoint site. Inside the user control i have a RadGRid (Rad controls version 2009.1.527.20). Now my problem is that i am constantly getting the exception 'Script control 'RadGrid1' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().
Parameter name: scriptControl
' at the following line of code 

_control.RenderControl(writer); Here _control is the user control.

Please let me know how to get around this exception. Also do let me know in case u require anyother info or if i am missing something.

Thanks
Kripa

Tsvetoslav
Telerik team
 answered on 03 Dec 2009
1 answer
199 views
Hi
I am using the radcombobox inside the radgrid. While select the radcombobox need to get the container item value in the client side. I can able to get the combobox text & value. But the problem is, I can't get the "Default_StatusENUM" value which is stored in data container.

ASPX:
<telerik:radgrid ID="gvSOComment" runat="server" Width="100%" GridLines="Both" AutoGenerateColumns="False" 
                                AllowSorting="True" ShowStatusBar="true" OnItemCommand="gvSOComment_ItemCommand" 
                                OnItemDataBound="gvSOComment_ItemDataBound"   
                                OnSortCommand="gvSOComment_SortCommand">  
                                <MasterTableView EditMode="InPlace" EnableViewState="true" GroupLoadMode="Client" 
                                    Width="100%" DataKeyNames="WOID, CodeId, Sequence">  
                                    <ItemStyle Width="120px" /> 
                                    <HeaderStyle Width="120px" /> 
                                    <NoRecordsTemplate> 
                                        No Data found.  
                                    </NoRecordsTemplate> 
                                    <Columns> 
                                        <telerik:GridTemplateColumn HeaderText="Comment Type" SortExpression="CodeId" ShowSortIcon="true">  
                                            <ItemTemplate> 
                                                <asp:Label runat="server" ID="lblWorkCode" Width="250px">  
                                                </asp:Label> 
                                            </ItemTemplate> 
                                            <EditItemTemplate> 
                                                <telerik:RadComboBox ID="cmbWorkCode" runat="server" Width="250px" Height="200px" DataValueField="CodeId" 
                                                    DataTextField="CodeName" SortExpression="CodeName" OnClientSelectedIndexChanged="OnClientSelectedIndexChangedEventHandler">  
                                                    <ItemTemplate> 
                                                    <table><tr>  
                                                    <td><%# DataBinder.Eval(Container.DataItem, "CodeName") %></td>  
                                                    <td><%# DataBinder.Eval(Container.DataItem, "Default_StatusENUM") %></td>  
                                                    </tr></table>  
                                                    </ItemTemplate> 
                                                </telerik:RadComboBox> 
                                            </EditItemTemplate> 
                                        </telerik:GridTemplateColumn> 
                                    </Columns> 
                                    <EditFormSettings CaptionFormatString="Edit details for Comments with ID {0}" CaptionDataField="WOID">  
                                        <FormTableItemStyle Width="100%" Height="29px"></FormTableItemStyle> 
                                        <FormTableStyle GridLines="None" CellSpacing="0" CellPadding="2"></FormTableStyle> 
                                        <FormStyle Width="100%" BackColor="#eef2ea"></FormStyle> 
                                    </EditFormSettings> 
                                </MasterTableView> 
                                <ClientSettings> 
                                    <ClientEvents OnColumnClick="ColumnClick" OnGridCreated="GridCreated"></ClientEvents> 
                                </ClientSettings> 
                                <ItemStyle Wrap="True"></ItemStyle> 
                            </telerik:radgrid> 
Java Script:
<script type="text/javascript" 
    function OnClientSelectedIndexChangedEventHandler(sender, eventArgs) {  
        var item = eventArgs.get_item();  
        var dataItem = eventArgs.get_dataItem();  
        alert(dataItem.CodeName);  
        alert(dataItem.Default_StatusENUM);  
    }  
</script> 

Thanks in advance.

Regards,
RAJASEKAR NAMMALVAR
Shinu
Top achievements
Rank 2
 answered on 03 Dec 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?