Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
242 views

I am getting the pagemethods is undefined message in my pageLoad method. Can you suggest how to fix this error?

this is my webusercontrol for my grid with the pageload method

 

Thaks for your help - John

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MasterPartsList.ascx.cs" 
   Inherits="UserControls_MasterPartsList" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<telerik:RadSplitter ID="RadSplitter1" runat="server" Height="100%" Width="100%" 
   VisibleDuringInit="false">  
   <telerik:RadPane ID="Radpane2" runat="server">  
      <telerik:RadAjaxManagerProxy ID="RadAjaxManager1" runat="server">  
         <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadGrid2">  
               <UpdatedControls> 
                  <telerik:AjaxUpdatedControl ControlID="RadGrid2" /> 
               </UpdatedControls> 
            </telerik:AjaxSetting> 
         </AjaxSettings> 
      </telerik:RadAjaxManagerProxy> 
      <telerik:RadScriptBlock ID="RadCodeBlock1" runat="server">  
 
         <script type="text/javascript">  
        <!--  
             function pageLoad(sender, eventArgs) {  
 
                 var tableView = $find("<%= RadGrid2.ClientID %>").get_masterTableView();  
 
                 PageMethods.GetData(0,   
                                     tableView.get_pageSize(),  
                                     tableView.get_sortExpressions().toString(),   
                                     tableView.get_filterExpressions().toList(),  
                                     updateGrid);  
 
                 PageMethods.GetCount(tableView.get_filterExpressions().toList(), updateVirtualItemCount);  
             }  
 
             function RadGrid2_Command(sender, args) {  
                 args.set_cancel(true);  
 
                 var pageSize = sender.get_masterTableView().get_pageSize();  
 
                 var sortExpressions = sender.get_masterTableView().get_sortExpressions();  
                 var filterExpressions = sender.get_masterTableView().get_filterExpressions();  
 
                 var currentPageIndex = sender.get_masterTableView().get_currentPageIndex();  
 
                 if (args.get_commandName() == "Filter")  
                     currentPageIndex = 0;  
 
 
                 var sortExpressionssortExpressionsAsSQL = sortExpressions.toString();  
                 var filterExpressionsfilterExpressionsAsSQL = filterExpressions.toString();  
 
                 PageMethods.GetData(currentPageIndex * pageSize, pageSize, sortExpressionsAsSQL, filterExpressions.toList(), updateGrid);  
 
                 if (args.get_commandName() == "Filter") {  
                     PageMethods.GetCount(filterExpressions.toList(), updateVirtualItemCount);  
                 }  
             }  
 
             function updateGrid(result) {  
                 var tableView = $find("<%= RadGrid2.ClientID %>").get_masterTableView();  
                 tableView.set_dataSource(result);  
                 tableView.dataBind();  
             }  
 
             function updateVirtualItemCount(result) {  
                 var tableView = $find("<%= RadGrid2.ClientID %>").get_masterTableView();  
                 tableView.set_virtualItemCount(result);  
             }  
 
             function toggleAllowMultiColumnSorting(sender, e) {  
                 var tableView = $find("<%= RadGrid2.ClientID %>").get_masterTableView();  
                 tableView.set_allowMultiColumnSorting(sender.checked);  
             }  
 
             function RadGrid2_RowDataBound(sender, args) {  
                 var radTextBoxPartNumber = args.get_item().findControl("PartNumber"); // find control  
                 radTextBoxPartNumber.set_value(args.get_dataItem()["PartNumber"]);  
 
                 // conditional formatting  
                 args.get_item().get_cell("TitleOfCourtesy").style.fontWeight = (args.get_dataItem()["TitleOfCourtesy"] == "Dr.") ? "bold" : "normal";  
 
                 var sb = new Sys.StringBuilder();  
 
                 sb.appendLine("<b>RadGrid2_RowDataBound</b><br />");  
 
                 for (var item in args.get_dataItem()) {  
                     sb.appendLine(String.format("{0} : {1}<br />", item, args.get_dataItem()[item]));  
                 }  
 
                 sb.appendLine("<br />");  
                 sb.appendLine("<br />");  
             }  
        --> 
         </script> 
 
      </telerik:RadScriptBlock> 
      <telerik:RadGrid ID="RadGrid2" runat="server" AutoGenerateColumns="False" AllowAutomaticInserts="True" 
         AllowAutomaticUpdates="True" AllowAutomaticDeletes="True" GridLines="None" PageSize="25" 
         AllowPaging="True" AllowSorting="True" OnNeedDataSource="RadGrid2_NeedDataSource" 
         OnDeleteCommand="RadGrid2_DeleteCommand" OnInsertCommand="RadGrid2_InsertCommand" 
         OnUpdateCommand="RadGrid2_UpdateCommand"   
         OnDataBound="RadGrid2_DataBound"   
         AllowFilteringByColumn="True">  
         <PagerStyle Mode="NextPrevAndNumeric" /> 
         <MasterTableView DataKeyNames="Id" CommandItemDisplay="TopAndBottom" EditMode="InPlace">  
            <Columns> 
               <telerik:GridBoundColumn DataField="Id" DataType="system.Int64" HeaderText="Id" ReadOnly="True" 
                  SortExpression="Id" UniqueName="Id" Visible="false">  
               </telerik:GridBoundColumn> 
               <telerik:GridTemplateColumn HeaderText="PartNumber" SortExpression="PartNumber" 
                  UniqueName="PartNumberColumn" EditFormColumnIndex="1">  
                  <ItemTemplate> 
                     <telerik:RadTextBox runat="server" ID="PartNumber" ></telerik:RadTextBox> 
                  </ItemTemplate> 
               </telerik:GridTemplateColumn> 
               <telerik:GridTemplateColumn HeaderText="Description" SortExpression="Description" 
                  UniqueName="Description" EditFormColumnIndex="2">  
                  <ItemTemplate> 
                     <telerik:RadTextBox runat="server" ID="Description" ></telerik:RadTextBox> 
                  </ItemTemplate> 
               </telerik:GridTemplateColumn> 
               <telerik:GridTemplateColumn HeaderText="PartType" SortExpression="PartType" UniqueName="PartType" 
                  EditFormColumnIndex="3">  
                  <ItemTemplate> 
                     <telerik:RadComboBox runat="server" ID="PartType">  
                     </telerik:RadComboBox> 
                  </ItemTemplate> 
               </telerik:GridTemplateColumn> 
               <telerik:GridTemplateColumn HeaderText="UOM" SortExpression="UnitOfMeasure" UniqueName="UnitOfMeasure" 
                  EditFormColumnIndex="4">  
                  <ItemTemplate> 
                     <asp:Label runat="server" ID="LblUnitOfMeasure" Text='<%# Eval("UnitOfMeasure") %>'>  
                     </asp:Label> 
                     &nbsp;  
                  </ItemTemplate> 
                  <EditItemTemplate>                   
                     <telerik:GridDropDownColumn DataField="UnitOfMeasure" HeaderText="UOM" ListTextField="Code" 
                        ListValueField="Description" UniqueName="UnitOfMeasure"   
                        DropDownControlType="RadComboBox" AllowSorting="true">  
                     </telerik:GridDropDownColumn> 
                  </EditItemTemplate> 
               </telerik:GridTemplateColumn> 
               <telerik:GridTemplateColumn HeaderText="Comm Code" SortExpression="CommodityCode" 
                  UniqueName="CommodityCode" EditFormColumnIndex="5">  
                  <ItemTemplate> 
                     <asp:Label runat="server" ID="LblCommodityCode" Text='<%# Eval("CommodityCode") %>'></asp:Label> 
                  </ItemTemplate> 
                  <EditItemTemplate> 
                     <telerik:GridDropDownColumn DataField="CommodityCode" HeaderText="UOM" ListTextField="Code" 
                        ListValueField="Description" UniqueName="CommodityCode">  
                     </telerik:GridDropDownColumn> 
                  </EditItemTemplate> 
               </telerik:GridTemplateColumn> 
               <telerik:GridEditCommandColumn ButtonType="ImageButton">  
                  <HeaderStyle Width="20px" /> 
                  <ItemStyle CssClass="MyImageButton" /> 
               </telerik:GridEditCommandColumn> 
               <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" Text="Delete" 
                  UniqueName="DeleteColumn" ConfirmText="Delete this Part?">  
                  <HeaderStyle Width="20px" /> 
                  <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" /> 
               </telerik:GridButtonColumn> 
            </Columns> 
            <EditFormSettings ColumnNumber="2" CaptionDataField="PartNumber" CaptionFormatString="Edit properties of Part {0}">  
               <FormTableItemStyle Wrap="False"></FormTableItemStyle> 
               <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle> 
               <FormMainTableStyle GridLines="Horizontal" CellSpacing="0" CellPadding="3" BackColor="White" 
                  Width="100%" /> 
               <FormTableStyle CellSpacing="0" CellPadding="2" CssClass="module" Height="110px" 
                  BackColor="White" /> 
               <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle> 
               <EditColumn ButtonType="ImageButton" InsertText="Insert Order" UpdateText="Update record" 
                  UniqueName="EditCommandColumn1" CancelText="Cancel edit">  
               </EditColumn> 
               <FormTableButtonRowStyle HorizontalAlign="Right" CssClass="EditFormButtonRow"></FormTableButtonRowStyle> 
            </EditFormSettings> 
         </MasterTableView> 
      </telerik:RadGrid> 
   </telerik:RadPane> 
</telerik:RadSplitter> 
 


and this is the .aspx page which contains the webusercontrol

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Proposal.aspx.cs" Inherits="_Default" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<%@ Register TagPrefix="nwd" TagName="ProposalDetailsPage" Src="~/UserControls/ProposalDetails.ascx" %> 
<%@ Register TagPrefix="nwd" TagName="MasterPartsListPage" Src="~/UserControls/MasterPartsList.ascx" %> 
<%@ Register TagPrefix="nwd" TagName="StructurePage" Src="~/UserControls/Structure.ascx" %> 
<%@ Register TagPrefix="qsf" TagName="Header" Src="~/Common/Header.ascx" %> 
<%@ Register TagPrefix="qsf" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %> 
<%@ Register TagPrefix="qsf" TagName="Footer" Src="~/Common/Footer.ascx" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">  
<head runat="server">  
   <title>Harris Corporation | Proposal Material Management Application</title> 
   <link href="Styles/Styles.css" rel="stylesheet" type="text/css" /> 
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
   <qsf:HeadTag ID="Headtag1" runat="server"></qsf:HeadTag> 
   <style type="text/css">  
      .rcbHeader ul, .rcbFooter ul, .rcbItem ul, .rcbHovered ul, .rcbDisabled ul  
      {  
         width: 100%;  
         display: inline-block;  
         margin: 0;  
         padding: 0;  
         list-style-type: none;  
      }  
      .rcbHeader ul:after, .rcbFooter ul:after, .rcbItem ul:after, .rcbHovered ul:after, .rcbDisabled ul:after  
      {  
         content: ".";  
         display: block;  
         visibility: hidden;  
         font-size: 0;  
         line-height: 0;  
         height: 0;  
         clear: both;  
      }  
      .col1, .col2, .col3  
      {  
         float: left;  
         width: 120px;  
         margin: 0;  
         padding: 0 5px 0 0;  
         line-height: 14px;  
      }  
      label.text  
      {  
         font: 13px 'Segoe UI' , Arial, sans-serif;  
         color: #4888a2;  
         padding: 6px 18px 0 0;  
         display: inline-block;  
         clear: both;  
         width: 150px;  
      }  
      .combo-list  
      {  
         list-style: none;  
         padding: 0;  
         margin: 0;  
      }  
   </style> 
</head> 
<body> 
   <form id="form2" runat="server">  
      <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">  
         <Scripts> 
            <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" /> 
         </Scripts> 
      </asp:ScriptManager> 
      <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
      </telerik:RadAjaxManager> 
      <telerik:RadFormDecorator runat="server" ID="RadFormDecorator1" DecoratedControls="All" 
         DecorationZoneID="decorationZone" /> 
      <div class="wrapper">  
         <div class="header">  
            <h1> 
               Mammoth</h1> 
            <h2> 
               Material Costing Application</h2> 
            <br /> 
            <h3> 
               Proposal:  
               <asp:PlaceHolder ID="placeHolderProposalName" runat="server" /> 
            </h3> 
            <div class="chooser">  
               <label for="SkinChooser_Input">  
                  Choose skin:</label> 
               <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" Skin="Office2007" 
                  Enabled="true" PersistenceMode="Session">  
               </telerik:RadSkinManager> 
            </div> 
         </div> 
         <div class="tabstrip">  
            <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1" 
               SelectedIndex="0" ShowBaseLine="true">  
               <Tabs> 
                  <telerik:RadTab Text="Details">  
                  </telerik:RadTab> 
                  <telerik:RadTab Text="Master Parts List">  
                  </telerik:RadTab> 
                  <telerik:RadTab Text="Structure">  
                  </telerik:RadTab> 
               </Tabs> 
            </telerik:RadTabStrip> 
         </div> 
         <div id="decorationZone" class="splitter">  
            <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0" CssClass="pageView">  
               <telerik:RadPageView ID="RadPageView1" runat="server">  
                  <nwd:ProposalDetailsPage ID="ProposalDetailsPage" runat="server" navigationlanguage="c#" /> 
               </telerik:RadPageView> 
               <telerik:RadPageView ID="RadPageView2" runat="server">  
                  <nwd:MasterPartsListPage ID="MasterPartsListPage" runat="server" navigationlanguage="c#" /> 
               </telerik:RadPageView> 
               <telerik:RadPageView ID="RadPageView3" runat="server">  
                  <nwd:StructurePage ID="StructurePage" runat="server" navigationlanguage="c#" /> 
               </telerik:RadPageView> 
            </telerik:RadMultiPage> 
         </div> 
         <div class="footer">  
            <br /> 
            <asp:HyperLink ID="returnToProposalIndex" runat="server" NavigateUrl="~/Default.aspx">Return to Proposal Index</asp:HyperLink> 
         </div> 
      </div> 
   </form> 
</body> 
</html> 
 

 

Tsvetoslav
Telerik team
 answered on 15 Sep 2009
2 answers
858 views
I have one grid on my page, that I am performing Insert/Update/Delete operations on.  On the page I have the RadAjaxManagerProxy (I'm doign this in a UserControl), the RadAjaxLoadingPanel, and the RadGrid.  I am not using a datasource on the page, but am binding to a datasource on the server.  All Insert/Update/Delete events are being bound on the server side also.

All events fire, all data operations are performing correctly, and I am calling the Rebind() method after the data operations.  However, the grid itself does not show the updated results unless I refresh the page completely.

As I've seen suggested on other posts, I've trie disabling the grid viewstate, and tried wrapping the grid in a RadAjaxPanel.  Nothing works.  What do I need to do to get the grid to refresh???
Random Blackburn
Top achievements
Rank 1
 answered on 15 Sep 2009
3 answers
101 views
Hi, I would like just basic sorting, but I don't know why, but I don't see link and image, and does't not work...

 <telerik:RadGrid ID="radGridUsers"
                    AllowAutomaticUpdates="False"
                    AllowAutomaticDeletes="False"
                    AutoGenerateColumns="False"
                    AllowPaging="True"
                    AllowSorting="True"
                    GridLines="None"
                    runat="server"
                    AllowMultiRowSelection="True"
                    PageSize="5"
                    OnNeedDataSource="radGridUsers_NeedDataSource"
                    OnItemCommand="radGridUsers_ItemCommand"
                    OnItemCreated="radGridUsers_ItemCreated"
                    OnDataBound="radGridUsers_DataBound" Width="100%">
                    <PagerStyle Mode="NextPrevAndNumeric" />
                    <MasterTableView
                        Width="100%"
                        CommandItemDisplay="Top"                     
                        DataKeyNames="PK_Users"
                        ClientDataKeyNames="PK_Users"
                        OverrideDataSourceControlSorting="true" >
                        <CommandItemTemplate>
                            <div style="padding: 5px 5px;">
                                <asp:LinkButton ID="lnkAdd" OnClientClick="return radGridUsers_AddNewUser();" runat="server">                                    
                                    <img src="<%# GetImage("Add") %>" style="border:0px" alt="" />
                                    <asp:Label ID="Label3" runat="server" meta:resourcekey="GridViewColumn_Command_Insert"  />
                                </asp:LinkButton>
                                &nbsp;&nbsp;                        
                                <asp:LinkButton ID="lnkDelete" runat="server" CommandName="DeleteSelectedUsers">
                                    <img src="<%# GetImage("Delete") %>" style="border:0px" alt="" />
                                    <asp:Label ID="Label2" runat="server" meta:resourcekey="GridViewColumn_Command_Delete"  />                                                             
                                </asp:LinkButton>
                                &nbsp;&nbsp;
                                <asp:LinkButton ID="lnkRefresh" runat="server" CommandName="RebindGrid">
                                    <img src="<%# GetImage("Refresh") %>" style="border:0px" alt="" />
                                    <asp:Label ID="Label1" runat="server" meta:resourcekey="GridViewColumn_Command_Refresh"  />                                 
                                </asp:LinkButton>
                                &nbsp;&nbsp;
                                <asp:LinkButton ID="lnkShowColumnPhoto" runat="server" CommandName="ShowHideColumnPhoto">
                                    <asp:Label ID="Label4" runat="server" meta:resourcekey="GridViewColumn_Command_ShowHidePhoto" Text="Show/hide column photo" />
                                </asp:LinkButton>                                
                                &nbsp;&nbsp;
                                <asp:LinkButton ID="lnkSync" runat="server">
                                    
                                    <asp:Label ID="Label5" runat="server" Text="Synchronise with tavis" />
                                </asp:LinkButton>                                                                
                            </div>
                        </CommandItemTemplate>
                        <Columns>        
                            <telerik:GridBoundColumn DataField="Name" UniqueName="Name"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="BadgeCode" UniqueName="BadgeCode"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Description" UniqueName="Description"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="IsInactive" UniqueName="IsInactive"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="IsLocalUser" UniqueName="IsLocalUser"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="CardsMode" UniqueName="CardsMode"></telerik:GridBoundColumn>
                            <telerik:GridBinaryImageColumn DataField="Photo" UniqueName="Photo" ImageAlign="NotSet" ImageHeight="80px" ImageWidth="80px" ResizeMode="Fit" />
                        </Columns>
                    </MasterTableView>
                    <ClientSettings>
                        <ClientEvents
                            OnRowDblClick="radGridUsers_ClientRowDblClick"/>
                        <Selecting AllowRowSelect="True"/>
                    </ClientSettings>      
                </telerik:RadGrid>   
             </telerik:RadAjaxPanel>           

Thanks for your help...

Sophie
Top achievements
Rank 1
 answered on 15 Sep 2009
7 answers
200 views
I have a calendar you can view here
http://alpha.clickablecommunity.com/Calendar.aspx
When the page loads initially the calendar views fine. However, as soon as you change the view i.e. to day or month the calendar gets wider. However, if you resize your browser window at all (doubleclick to resize down and then resize up again), then it goes back to the proper size. I am completely stumped on this one. Here is my code.
aspx
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/MasterPage.Master" CodeBehind="Calendar.aspx.vb" Inherits="ClickableCommunity.Calendar" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript">
    function HideAppointment() {  
    
        var Scheduler = $find('<%= RadScheduler1.ClientID %>');  
        var app1 = Scheduler.get_appointments();  
        alert("Hiding the appointment : " + app1.getAppointment(1).get_subject());
        app1.getAppointment(1).style.display = "none";    // Hide the first appointment   
        
    }//HideAppointment
    function ShowAppointment() {  
    
        var Scheduler = $find('<%= RadScheduler1.ClientID %>');  
        var app1 = Scheduler.get_appointments();  
        alert("Showing the appointment : " + app1.getAppointment(1).get_subject());
        app1.getAppointment(1)._domElements[0].style.display = "block";   // Show the first appointment
        
    }//ShowAppointment
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="header" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="menuContent" runat="server">
<span style="padding-left:10px;">Coming soon...<br />
                                <a href="#" onclick="HideAppointment()">Hide</a></span>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
<div id="divCalendar">
    <telerik:RadScheduler ID="RadScheduler1" runat="server" Height="500px"
                          HoursPanelTimeFormat="htt" Skin="Web20" ValidationGroup="RadScheduler1"
                          GroupingDirection="Vertical" CssClass="calendarView"
        SelectedView="WeekView"
        WeekView-DayStartTime="08:00:00"
        WeekView-DayEndTime="23:59:00"
        WeekView-WorkDayEndTime="23:59:00"
        WeekView-WorkDayStartTime="08:00:00"
        WorkDayEndTime="23:59:00"
        DayEndTime="23:59:00"
        DayView-DayEndTime="23:59:00"
        DayView-DayStartTime="08:00:00"
        DayView-WorkDayEndTime="23:59:00"
        DayView-WorkDayStartTime="08:00:00" AllowDelete="false" AllowEdit="false" AllowInsert="false"
        TimelineView-NumberOfSlots="7">
        <DayView GroupingDirection="Horizontal" UserSelectable="True"  />
        <TimelineView GroupingDirection="Horizontal" />
        <WeekView GroupingDirection="Horizontal" />
    </telerik:RadScheduler>
    </div>
<asp:SqlDataSource ID="eventsDataSource" runat="server"
    ConnectionString="<%$ ConnectionStrings:connectionString %>"
    SelectCommand="returnAllEvents" SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
</asp:Content>

VB
Imports System.Data
Imports System.Data.Sql
Imports System.Data.SqlClient
Imports Telerik.Web.UI
Partial Public Class Calendar
    Inherits System.Web.UI.Page

    'my 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

            Dim table As DataTable = New DataTable()
            table.Columns.Add("start")
            table.Columns.Add("end")
            table.Columns.Add("key")
            table.Columns.Add("subject")

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

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

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

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

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

                While dr.Read()

                    '0eventid, 1FK_CategoryID, 2latitude, 3longitude, 4events.name, 5description, 6businesses.name,
                    '7starttime, 8stoptime, 9locations.street, 10locations.city, 11locations.state, 12locations.zip

                    'set all of the textboxes to the input
                    table.Rows.Add(New String() {dr.Item(7), dr.Item(8), dr.Item(0), _
                                                 "Name: " & dr.Item(6)})

                End While 'while dr.read()

            Catch ex As Exception

            Finally

            End Try

            Dim calendar As RadScheduler = RadScheduler1
            calendar.DataSource = table
            calendar.DataStartField = "start"
            calendar.DataEndField = "end"
            calendar.DataKeyField = "key"
            calendar.DataSubjectField = "subject"
            calendar.DataBind()

        End If 'if not page.ispostback
    End Sub

End Class

Master page
 <%@ Master Language="VB" AutoEventWireup="false" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register TagPrefix="loginDivTemplate" TagName="login" src="/ascx/loginTemplate.ascx"%>
<!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">
<%@ import namespace="System.Data" %>
<%@ import namespace="System.Data.Sql" %>
<%@ import namespace="System.Data.SqlClient" %>
<%@ import namespace="Telerik.Web.UI" %>
<head id="Head1" runat="server">
    <link href="ClickableCommunity.css" rel="stylesheet" type="text/css" />
    <title></title>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body id="MasterBody" runat="server" style="margin: 0px; height: 100%; overflow: hidden;">
    <form id="Form1" method="post" runat="server" style="height: 100%">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <br />
    <asp:ContentPlaceHolder ID="header" runat="server">
    </asp:ContentPlaceHolder>
    <div id="loginDiv">
        <loginDivTemplate:login id="loginPanelContent" runat="server"></loginDivTemplate:login>
    </div>
    <div id="topDiv">
        <div id="image" class="topDivImage">
            <img src="images/logo.jpg" alt="Clickable Community Logo" width="200" height="75" />
        </div>
        <div id="viewMenu" class="viewMenu">
            <center>
                <table><tr><td>
                    <telerik:RadMenu ID="RadMenu1" runat="server" Skin="Web20">
                        <Items>
                            <telerik:RadMenuItem runat="server" Text="Events View">
                                <Items>
                                    <telerik:RadMenuItem runat="server" NavigateUrl="~/Default.aspx" Text="Map">
                                    </telerik:RadMenuItem>
                                    <telerik:RadMenuItem runat="server" NavigateUrl="~/Lis.aspx" Text="List">
                                    </telerik:RadMenuItem>
                                    <telerik:RadMenuItem runat="server" Text="Calendar" NavigateUrl="Calendar.aspx">
                                    </telerik:RadMenuItem>
                                </Items>
                            </telerik:RadMenuItem>
                        </Items>
                    </telerik:RadMenu>
                </td></tr></table>
            </center>
        </div>
    </div>
    <telerik:RadSplitter ID="RadSplitter1" runat="server" Orientation="Vertical" Width="100%" CssClass="AllContent" LiveResize="true">
        <telerik:RadPane ID="LeftRadPane1" runat="server" Width="220px" Scrolling="Both"
            BorderStyle="None" BorderSize="0">
            <div id="leftPanel">
                <asp:ContentPlaceHolder ID="menuContent" runat="server">
                    
                </asp:ContentPlaceHolder>
            </div>
        </telerik:RadPane>
        <telerik:RadSplitBar runat="server" ID="RadSplitBar2" CollapseMode="Forward" EnableResize="false"
            ForeColor='Green' />
        <telerik:RadPane ID="RightRadPane1" runat="server" CssClass="RightPanelPadding" Scrolling="Both"
            BorderStyle="None" BorderSize="0" Height="100%">
            <asp:ContentPlaceHolder ID="MainContent" runat="server">
            
            </asp:ContentPlaceHolder>
        </telerik:RadPane>
        
    </telerik:RadSplitter>
    </form>
</body>
</html>
And css
html, body, form  
{  
   height: 100%;
   width: 100%;
   margin: 0;  
   padding:0;  
}
#leftPanel{
    display:inline;
    width:220px;
    border-top-style: none;
    border-right-style: none;
    border-left-style: none;
        
}
.normalText{
    font-size:12px;
    font-family: Arial;
}
.loginLabel{
    padding-right: 10px;
    padding-bottom: 10px;
}
.loginTextBox{
    width: 120px;
}
.leftPanelContent{
    padding-bottom: 30px;
}
#topDiv{
    height: 60px;
    border-bottom-width: 4px;
    border-bottom-color: Gray;
    border-bottom-style:groove;
        
}
.calendarView{
    width:auto !important;
}
.tableColumn{
    width:150px;
}
#loginDiv{
    position: absolute;
    display:inline;
    right: 10px;
    top: 5px;
}
#menuDiv{
    position: absolute;
    padding-top: 75px;
    margin-left: auto;
    margin-right:auto;
}
.AllContent{
    border-right: none;
    height: auto;
    
}
.businessToolTip{
    position: absolute;
    z-index: 500;
    top:300px;
    left:300px;
}
.stateDropDownText{
    font-size: 11px;
    font-family: Arial;

}
.adminTableDiv{
    text-align: center;
    width: 200px;
    height:100%;
    padding-right:20px;
    display: inline;
}
.adminMainDiv{
    width: 420px;
}
.center{
    padding-left:auto;
    padding-right:auto;
}
.textRed{
    color: Red;
}
.successText{
    color:Green;
}
.addBusinessSpacing{
    padding-right: 20px;
    height: 70px;
}
.adminTableLabel{
    text-align: center;
    display: block;
}
.addBusinessTextBox{
    width:150px;
    text-align:center;
}
#MainContent{
    display:inline;

}
.displayInline{
    display: inline;
}
#divMap{
    height: 500px;
    border: groove 4px #EEEEEE;
    border-right: groove 4px #EEEEEE;
    margin-left: auto;
    margin-right: auto;
    padding-right: 10px;
}
#divCalendar{
    height: 500px;
    border: groove 4px #EEEEEE;
    margin-left: auto;
    margin-right: auto;
    width:auto;
}
.RightPanelPadding
{
    position: relative;
    height:auto !important;
    padding-left: 10px;
    padding-top:10px;
    padding-right:10px;
    padding-bottom: 10px;
    margin-top: auto;
    margin-bottom: auto;
    
    
}
.errorMessage{
    color: Red;
    font-size: 10px;
    font-family: Arial;
}
.topDivImage{
position: absolute;
top: 0;
left: 0;
display:inline;
width:220px;
}
.viewMenu{
padding-left:220px;
margin-right:auto;
margin-left:auto;
text-align:center;
width:800px;
vertical-align:bottom;
padding-top: 34px;
}
.emptyTextboxText{

    font-style:italic;
    font-size:10px;
    color: #D8D8D8;

}

Although I bind it in the codebehind, you can do it in the aspx page and get the same problem. Any ideas? Thanks,


Web Services
Top achievements
Rank 2
 answered on 15 Sep 2009
4 answers
89 views
Hi all, I'm having a bit of a strange problem (albeit minor) in which if the ComboBox is clicked before a page is finished loading, the menu opens up in the bottom right corner of the page as apposed to under the combobox as it should be.  I'm wondering if this is a documented issue or if it is something that should be fixable on my end.  This isn't a major issue as our clients would really have to WORK to click the combobox box before the page loads and still the combobox still functions, however I'd really like to fix this problem if possible!

Thank you!
Simon
Telerik team
 answered on 15 Sep 2009
2 answers
204 views
Hello,

I've created a site management system that has a base theme that is loaded via the pages directive in the web.config:
<pages ... styleSheetTheme="Base">...</pages> 

Then, to customize the look and feel for an individual site, I reference a theme in the Page_PreInit method:
Me.Theme = "SiteTheme" 

This works great.  Anything defined in the Base theme gives you a standard appearance for any given component of the system.  However, if you want to override the look and feel for an individual site, you can declare the same CSS definitions inside the Site Theme.

If I were to use the StyleSheet Manager to combine CSS files, when would they get loaded.  My goal would be to manage all of the Base theme information with the StyleSheet Manager and still allow them to be overridden by the Site Theme.

Another side question:  Would the StyleSheet Manager help beyond just combining all of the CSS files in my Base theme into a single CSS file?

Thank you.
LeBear
Top achievements
Rank 1
 answered on 15 Sep 2009
2 answers
159 views
Greetings,

I create a RadComboBox at runtime based on a user's selection of items in a grid.  As the user selects items in the gird, I add an entry to the RadComboBox.  The RadComboBox serves as a 'breadcrumb' strategy to move the user back to a position in the grid based on what they've selected in the RadComboBox.  I use the OnClientSelectedIndexChanged event to reposition the user's location in the grid.  My problem is this strategy fails when only one item is found in the RadComboBox.  Clearly, OnClientSelectedIndexChanged won't work because they can never change the selected item.  Can anybody suggest a strategy to avoid this problem or to overcome it?  It would be nice to handle a RadComboBoxItem click event but I don't see that as supported.  I could add a blank item to the combo box, but it does not meet user requirements.  Any suggestions would be appreciated.  Thanks.
Kurt Boeckman
Top achievements
Rank 1
 answered on 15 Sep 2009
2 answers
149 views

Let me explain.
I have a grid which is made like that:

<td valign=bottom>  
                                    <telerik:RadGrid   
                                        ID="RadGrid2"   
                                        Skin="Vista"   
                                        runat="server"   
                                        OnNeedDataSource="RadGrid2_NeedDataSource" 
                                        ShowFooter=true   
                                        CommandItemStyle-HorizontalAlign=Center>    
                                          <MasterTableView   
                                            ShowFooter=true    
                                            CommandItemDisplay="bottom"   
                                            EditMode="InPlace" >    
                                              <CommandItemTemplate> 
                                                  <asp:LinkButton ID="LinkButton1" CommandName="UpdateChanges" Runat="server" CssClass="TexteBlanc16">Importer tous</asp:LinkButton> 
                                              </CommandItemTemplate> 
                                              <Columns>                       
                                                  <telerik:GridTemplateColumn UniqueName="CodePermanent" HeaderText="Code Permanent">    
                                                      <ItemTemplate>    
                                                          <asp:TextBox ID="TxtCodePermanent" runat="server"></asp:TextBox>    
                                                      </ItemTemplate>    
                                                  </telerik:GridTemplateColumn>    
                                             </Columns>    
                                       </MasterTableView>    
                                    </telerik:RadGrid>   
                                </td> 
                                <td valign=bottom>  
                                    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Ajouter une ligne" /> 
                                </td> 

Public Sub RadGrid2_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs)  
        If Not IsPostBack Then  
            dt = AddRow(dt)  
            ' call the method to create row   
            ViewState("dt") = dt  
        End If  
        dt = DirectCast(ViewState("dt"), DataTable)  
        RadGrid2.DataSource = dt 
    End Sub  
 
Private Function AddRow(ByVal dt As DataTable) As DataTable  
        ' method to create row   
        Dim dr As DataRow = dt.NewRow()  
        dr("RowNumber") = ""  
        dt.Rows.Add(dr)  
        Return dt  
    End Function  
 
 Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)  
        Dim countitem As Integer  
        Dim dt As DataTable = DirectCast(ViewState("dt"), DataTable)  
 
        countitem = RadGrid2.Items.Count  
        Dim cpt As Integer = 0 
        For Each Item As GridDataItem In RadGrid2.Items  
 
            Dim txtcode As TextBox = DirectCast(Item("CodePermanent").FindControl("TxtCodePermanent"), TextBox)  
            If Not (txtcode.Text Is Nothing) And txtcode.Text <> "" Then  
                liste.Add(txtcode.Text)  
 
            End If  
 
        Next  
        ViewState("dt") = AddRow(dt)  
        listcount = liste.Count  
 
        RadGrid2.Rebind()  
        While cpt < listcount 
            Dim txtcode As TextBox = DirectCast(RadGrid2.Items(cpt)("CodePermanent").FindControl("TxtCodePermanent"), TextBox)  
            txtcode.Text = liste.Item(cpt)  
            cptcpt = cpt + 1  
        End While  
    End Sub  
 
    Public Sub RadGrid2_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid2.ItemCommand  
        If e.CommandName = "UpdateChanges" Then  
            For Each Item As GridDataItem In RadGrid2.Items  
                Dim txtcode As TextBox = DirectCast(Item("CodePermanent").FindControl("TxtCodePermanent"), TextBox)  
                If Not (txtcode.Text Is Nothing) Then  
                    ImporterEtudiants(txtcode.Text)  
 
                End If  
            Next  
            Me.RadGrid_BanqueCV.Rebind()  
            If CodePermInvalide <> "" Then  
                Session("sCodePermInvalide") = CodePermInvalide  
 
                Response.Redirect("FEN_ERREUR.aspx?NoErreur=3")  
            End If  
 
        End If  
    End Sub  
 
    Public Function ImporterEtudiants(ByVal sCodePerm As String) As Boolean  
        Dim strSQLIdent As String  
        Dim cmdIdent As New SqlCommand  
        Dim myDAIdent As New SqlDataAdapter  
        Dim dsIdent As New DataSet  
        Dim strSQLIdentValide As String  
        Dim cmdIdentValide As New SqlCommand  
        Dim myDAIdentValide As New SqlDataAdapter  
        Dim dsIdentValide As New DataSet  
        Dim strSQLIdentInsert As String  
        Dim cmdIdentInsert As New SqlCommand  
        Dim myDAIdentInsert As New SqlDataAdapter  
        Dim dsIdentInsert As New DataSet  
        Dim DatedeNaissance As Date  
 
        strSQLIdentValide = "SELECT * FROM T_USAGER WHERE CODE_PERMANENT ='" & sCodePerm & "'"  
        cmdIdentValide = New SqlCommand(strSQLIdentValide, Conn)  
        myDAIdentValide = New SqlDataAdapter(cmdIdentValide)  
        Conn.Open()  
        myDAIdentValide.Fill(dsIdentValide)  
        Conn.Close()  
        If dsIdentValide.Tables(0).Rows.Count > 0 Then 'L'usager existe déjà dans la table T_USAGER  
            Effacer = 1 
            Return True  
        Else  
 
            strSQLIdent = "SELECT E_Ele.Fiche,CodePerm,DateNaiss,Nom,Pnom,NoCiv,Rue,Ville,CodePost,IndReg,Tel " & _  
            "FROM E_Ele " & _  
            "INNER JOIN E_Adr " & _  
            "ON E_Ele.Fiche = E_Adr.Fiche " & _  
            "INNER JOIN E_Freq ON E_Ele.Fiche = E_Freq.Fiche " & _  
            "GROUP BY E_Ele.Fiche, E_Ele.CodePerm, E_Ele.DateNaiss, E_Ele.Nom, E_Ele.Pnom, E_Adr.NoCiv, E_Adr.Rue, E_Adr.Ville, E_Adr.CodePost, E_Adr.IndReg, E_Adr.Tel, E_Adr.DateFin, E_Adr.EnvoiMeq " & _  
            "HAVING (((Max(E_Freq.DateFin))>'2008-01-01') AND ((E_Adr.DateFin)='') AND ((E_Adr.EnvoiMeq)='1')) AND CodePerm='" & sCodePerm & "'"  
 
            cmdIdent = New SqlCommand(strSQLIdent, ConnJadeAdulte)  
            myDAIdent = New SqlDataAdapter(cmdIdent)  
            ConnJadeAdulte.Open()  
            myDAIdent.Fill(dsIdent)  
            ConnJadeAdulte.Close()  
            If dsIdent.Tables(0).Rows.Count > 0 Then  
                DatedeNaissance = Left(dsIdent.Tables(0).Rows(0).Item("DateNaiss"), 4) & "-" & Mid(dsIdent.Tables(0).Rows(0).Item("DateNaiss"), 5, 2) & "-" & Right(dsIdent.Tables(0).Rows(0).Item("DateNaiss"), 2)  
                strSQLIdentInsert = "INSERT INTO T_USAGER (CODE_PERMANENT,MOT_PASSE,PRENOM,NOM,ADRESSE,VILLE,CODE_POSTAL,NO_TEL,COURRIEL,DATE_NAISSANCE,LETTRE_CONSENTEMENT,RECEVOIR_NOUVELLE_OFFRE,DIPLOME, PREMIERE_FOIS) " & _  
                                    "VALUES ('" & sCodePerm & "'," & dsIdent.Tables(0).Rows(0).Item("DateNaiss") & ",'" & Replace(Trim(dsIdent.Tables(0).Rows(0).Item("Pnom")), ",", "''") & "', '" & Replace(Trim(dsIdent.Tables(0).Rows(0).Item("Nom")), "'", "''") & "','" & Replace(Trim(dsIdent.Tables(0).Rows(0).Item("NoCiv")), "'", "''") & " " & Replace(Trim(dsIdent.Tables(0).Rows(0).Item("Rue")), "'", "''") & "','" & Replace(Trim(dsIdent.Tables(0).Rows(0).Item("Ville")), "'", "''") & "','" & dsIdent.Tables(0).Rows(0).Item("CodePost") & "','" & dsIdent.Tables(0).Rows(0).Item("IndReg") & dsIdent.Tables(0).Rows(0).Item("Tel") & "','','" & DatedeNaissance & "',0,0,0,1)"  
                cmdIdentInsert = New SqlCommand(strSQLIdentInsert, Conn)  
                myDAIdentInsert = New SqlDataAdapter(cmdIdentInsert)  
                Conn.Open()  
                myDAIdentInsert.Fill(dsIdentInsert)  
                Conn.Close()  
                Effacer = 1 
                Return True  
            Else  
                If CodePermInvalide = "" Then  
                    CodePermInvalide = sCodePerm 
                Else  
                    CodePermInvalideCodePermInvalide = CodePermInvalide & " <br> " & sCodePerm  
                End If  
                Effacer = 0 
                Return False  
            End If  
        End If  
         
          
    End Function  
 
     
    Private Sub RadGrid2_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid2.PreRender  
        RadGrid2.MasterTableView.RenderColumns(1).Display = False 
        RadGrid2.MasterTableView.RenderColumns(3).Display = False 
    End Sub 
Often, the user want to add more than one data at the time so I put 15 lines which are in edit mode. The user can enter 3 rows and then click on the "importer tous" button which valid if the values are ok. If they are, it's working fine. But if only 1 is not good I put it in a variable "CodePermInvalide" and redirect to an error page which display the CodePermInvalide value. Then I got a button on my error page like this:
<HREF="Javascript:history.go(-1)" >Retour</a> 
When I click on this link, I'm back to my first page and I see all my 3 records, but I would like to see only the values which are not good. It insert the good value in my database so I would like to not see them when I come back to the first page.
Hope that make sense. If you need more informations, please be free to ask as I don't know if I'm clear enought.
Thank you!
Myriam
Top achievements
Rank 1
 answered on 15 Sep 2009
0 answers
83 views
Hi guys,

I have enabled the  client side, drag and drop functionality on my page.
The treview is populated in the code behind and the nodes have a css class applied to them based on their type. One of the types has a blue border around the text.
When I drag this type of node on top of a textbox, in IE6 only , while I drag it, it shows a huge box with the blue border around it and it only dissapears once I drop the text in the textbox.
In any other browser the blue border does not show, only the text.
Any hints how to get rid of it ?


Andrei Dragotoniu
Top achievements
Rank 1
 asked on 15 Sep 2009
3 answers
85 views
If I want to determine whether a particular Rad Grid, Rad List  or RadTreeview has an item which is selected (or checked node in the case of Rad TReeview), I can use the inherent selectedItems or checkednodes properties that these controls expose. However, to determine if a single item is selected, it is not necessery to return all the selected items. Therefore it would seem to me, that a more efficient method of determining whether an item is selected is to loop through all the items and if you come across one which is selected, return true (ie exit the loop) This would be the case unless Telerik used some sort of optimization technique for storing the selecteditems collection without looping through the entire set to setermine it. So, my questions is, does this kind of optimization exists, or is my method of looping instead of using the inherent selecteditems collection a more optimized way of determining whether an item has been selected.

On a related note, is there a way to get a list of all the nodes in a treeveiw without actually traversing the tree in a recursive fashion (ie is there some sort of optimized method of obtaining the full node list)
Veselin Vasilev
Telerik team
 answered on 15 Sep 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?