Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
164 views
I have been developing a web site using the asp.net ajax controls and have finally got as far as deploying it onto a parallels hosted web site.
However when I try and access any pages with a telerik control on I get this error.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Unknown server tag 'telerik:RadTabStrip'.

Source Error:

Line 7:      TagPrefix="uc3" %>
Line 8:  <div style="background-color:#D6E5F3;">
Line 9:      <telerik:RadTabStrip ID="CreateSchoolTabStrip" runat="server" Skin="Office2007" MultiPageID="CreateSchoolMultipage"
Line 10:         SelectedIndex="1" CausesValidation="false">
Line 11:         <Tabs>

I've checked and the telerik.web.dll file is in the bin/debug directory along with the application dlls, but for some reason is failing to be picked up.
I'm sure this is something obvious about the remote server setup, but I can't seem to find a solution to it.
Any chance you could point me in the right direction here?

Thanks
Steve.
Stephen Bough
Top achievements
Rank 1
 answered on 12 Oct 2010
11 answers
283 views
I've run into 2 client requests I've been unable to do in Scheduler either because they are not possible or I don't know how. If these are possible, advice is appreciated.

The first is the request for tooltips for the empty times on the scheduler so that if they are looking at the end of the week and the times are across the screen, or if the dates are off the top of the screen, it will be easier to know the datetime of the  empty block.

The other problem is that I'd like to have a scheduler day view where resources run horizontally and the times are along the top. There are just scenarios where this is more space efficient, such as if there is 20 resources showing and all that is required is the title in a small block.
T. Tsonev
Telerik team
 answered on 12 Oct 2010
17 answers
382 views
What I want to do is pretty simple.. Id like to use Linq2Ent (worse case I can use SP) to create a simple grid..

When you load the page you have a list of catagories... when you click a category it expands and shows the quarter (2009q1, 2009q2, 2009q3,2009q4,2010q1 etc..) on each row with the amount spent for that quarter... I want to be able to edit those rows in the Details table.. so its simple right?

So I imagine I will need to queries... One query for the MasterTable (list of categories) and then when a row from the mastertable is clicked I will need another Linq2Ent query to take the ID for that category and get the list of quarters and show them underneath the categories..

Do I have the concept right? I know you don't have many examples using linq2Ent so I suppose the exact concept applies with store procedures... Do you have any very basic samples? The closest thing I could find is this.. and its more complex than I need.

http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/threelevel/defaultcs.aspx
Princy
Top achievements
Rank 2
 answered on 12 Oct 2010
7 answers
664 views

I have a scenario with multiple RadComboBoxes that don’t seem to fire the Itemsrequested server event  prior to receiving the response from the previous callback.  Here is a page that I wrote to show the problem. When the normal ASP.NET drop down changes indexes, it will make a callback that has a 5 seconds delay in it. If you press the drop down button for either of the RadComboBoxes during this time, it will display loading but never return. You have to click out of the combo box and then back in it to get the items to load.

 

RadComboBox 1 also has an onblur that calls an AJAX callback to a 5 second delay. If you try to drop down RadComboBox 2 during this delay, it will just show loading and not update.

 

Do you have any suggestion as to what might be causing this and how to get around it? Ideally the combo boxes will be able to either load during the callback or queue the request so that it will start when the previous callback is complete.


 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
  
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head id="Head1" runat="server">
    <title></title>
    <style type="text/css">
        .RadComboBoxDropDown .rcbItem, 
        .RadComboBoxDropDown .rcbHovered, 
        .RadComboBoxDropDown .rcbDisabled, 
        .RadComboBoxDropDown .rcbLoading
        {
            margin: 0 1px;
            padding: 2px 6px;
            white-space: pre;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <div>
    <asp:Label ID="lblDDL" Text="Drop Down 1" style="float:left;" runat="server"></asp:Label>
    <asp:DropDownList ID="DDLTest1" runat="server" style="float:left;" AutoPostBack="true" OnSelectedIndexChanged="DDLTest1_SelectedIndexChanged" >
        <asp:ListItem Text="apple" >
        </asp:ListItem>
        <asp:ListItem Text="orange" />
    </asp:DropDownList>
    <br />
    <br />
        <asp:Label ID="lblrcb1" Text="RadComboBox 1" runat="server" style="float:left;" />
        <telerik:RadComboBox ID="RadComboBox1" OnItemsRequested="RadComboBox1_ItemsRequested" style="float:left;" EnableLoadOnDemand="true" OnClientBlur="function(){$find('PageAjaxManager').ajaxRequest('RadComboBox1');}" EnableAjaxSkinRendering="true" ItemRequestTimeout="1000" runat="server">
        </telerik:RadComboBox>
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <asp:Label ID="lblrcb2" Text="RadComboBox 2" runat="server" style="float:left;" />
        <telerik:RadComboBox ID="RadComboBox2" OnItemsRequested="RadComboBox2_ItemsRequested" style="float:left;" EnableLoadOnDemand="true" EnableAjaxSkinRendering="true" ItemRequestTimeout="1000" runat="server">
        </telerik:RadComboBox>
    </div>   
    <telerik:RadAjaxManager ID="PageAjaxManager" runat="server" RequestQueueSize="5" >
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID ="DDLTest1" >
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="DDLTest1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
    </telerik:RadAjaxManager>
    </form>
</body>
  
</html>
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
using Telerik.Web.UI;
using System.Threading;
  
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
  
    protected void RadComboBox1_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
    {
        DataTable dataTable = new DataTable();
        dataTable.Columns.Add(new DataColumn("ID", typeof(string)));
        dataTable.Columns.Add(new DataColumn("Name", typeof(string)));
  
        DataRow dr = dataTable.NewRow();
        dr["ID"] = "1";
        dr["Name"] = Server.HtmlEncode("Name 1         2           3");
        dataTable.Rows.Add(dr);
  
        DataRow dr2 = dataTable.NewRow();
        dr2["ID"] = "2";
        dr2["Name"] = "Name 2    4";
        dataTable.Rows.Add(dr2);
  
        DataRow dr3 = dataTable.NewRow();
        dr3["ID"] = "3";
        dr3["Name"] = "1  Name 3";
        dataTable.Rows.Add(dr3);
  
        if (o is RadComboBox)
        {
  
            (o as RadComboBox).DataSource = dataTable;
            (o as RadComboBox).DataTextField = "Name";
            (o as RadComboBox).DataValueField = "ID";
            (o as RadComboBox).DataBind();
        }
    }
  
  
  
    protected void RadComboBox2_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
    {
        DataTable dataTable = new DataTable();
        dataTable.Columns.Add(new DataColumn("ID", typeof(string)));
        dataTable.Columns.Add(new DataColumn("Name", typeof(string)));
  
        DataRow dr = dataTable.NewRow();
        dr["ID"] = "1";
        dr["Name"] = Server.HtmlEncode("Name 1         2           3");
        dataTable.Rows.Add(dr);
  
        DataRow dr2 = dataTable.NewRow();
        dr2["ID"] = "2";
        dr2["Name"] = "Name 2    4";
        dataTable.Rows.Add(dr2);
  
        DataRow dr3 = dataTable.NewRow();
        dr3["ID"] = "3";
        dr3["Name"] = "1  Name 3";
        dataTable.Rows.Add(dr3);
  
        if (o is RadComboBox)
        {
  
            (o as RadComboBox).DataSource = dataTable;
            (o as RadComboBox).DataTextField = "Name";
            (o as RadComboBox).DataValueField = "ID";
            (o as RadComboBox).DataBind();
        }
    }
  
    protected override void RaisePostBackEvent(IPostBackEventHandler sourceControl, string eventArgument)
    {
        base.RaisePostBackEvent(sourceControl, eventArgument);
  
        if (sourceControl is RadComboBox || eventArgument == RadComboBox1.ClientID)
        {
            Thread.Sleep(5000);
        }
    }
  
    protected void DDLTest1_SelectedIndexChanged(object sender, EventArgs e)
    {
        Thread.Sleep(5000);
    }
  
}

 

 

Simon
Telerik team
 answered on 12 Oct 2010
5 answers
220 views
Hello,
I am developing a web application with ASP.NET 3.5 with C# and Telerik Ajax Control. I have a iFrame in my master page. Application load other pages in iFrame dynamically and iFrame height adjust the dynamically when page load. I uses RadScriptManager , RadAjaxPannel, RadAjaxLoadingPannel in my page. The problem is when "call back" the page, iFrame height not adjust dynamically.


<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head id="Head" runat="server">
    <title></title>
   
   <script type="text/javascript" language="JavaScript">
 
        
       function setSize(elem) {
           var the_height;
 
           the_height = elem.contentWindow.document.body.scrollHeight;
           elem.height = the_height; // Its works fine in IE, Chrome, Safari but not work in FF and opera
 
 
       }
       
        
 
</script>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
     
</head>
<body  id="Page_Master"  runat="server"  >
 
    <form id="formMasterPage" method="post" runat="server">
      
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"  AsyncPostBackTimeout="500">
    </telerik:RadScriptManager>
    
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="100%" Width="100%"   >
            
     
    <div id="MainPage">
       
        <div class="Header">
             
        </div>
         
        <div id="ContentHolder">
            <div id="Content">
                <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                </asp:ContentPlaceHolder>
                 
                <iframe id="IFrameMaster" name="IFrameMaster"  scrolling="auto" width="998px"  style=" min-height:500px;"  allowtransparency="true"   frameborder="0" runat="server" >
                </iframe>
              
                 
                 
            </div>
        </div>
        <div id="Footer">
             
        </div>
    </div>
     </telerik:RadAjaxPanel>
    
    </form>
 
</body>
</html>


Serverside Code :
// This code used in Page_Load Method and other methods depends on condition.
IFrameMaster.Attributes["src"] = "UIHome.aspx";
// This line used only Page_Load Method
IFrameMaster.Attributes.Add("onload", "javascript:setSize(this)");

How can I set iFrame height dynamic.

Thanks
Dimo
Telerik team
 answered on 12 Oct 2010
1 answer
56 views
I cannot get a RadToolTip to appear when a user sets focus on a RadEditor.
The code I am using is below:


<asp:TextBox ID="txt" runat="server" Text="try me" />
    <telerik:RadEditor ID="re1" runat="server">
    </telerik:RadEditor>
    <telerik:RadToolTip ID="RadToolTip1" runat="server" TargetControlID="re1"
        ShowEvent="OnFocus" Text="Test">
    </telerik:RadToolTip>
<telerik:RadEditor ID="re1" runat="server">
</telerik:RadEditor>
<telerik:RadToolTip ID="RadToolTip1" runat="server" TargetControlID="re1"
    ShowEvent="OnFocus" Text="Test">
</telerik:RadToolTip>

How do I go about this?
Thanks
Rumen
Telerik team
 answered on 12 Oct 2010
7 answers
652 views
All,

I am having problems getting my GridDropDownColumn to bind with the current value of my Grid data row.  I can get the drop down to bind to it's source but I can't seem to get it to set the correct selected value automatically.

Here is my ASPC Code:
<%@ Page Language="C#" MasterPageFile="~/MasterPages/Popup.Master" AutoEventWireup="true" CodeBehind="CompanyItemReference.aspx.cs" Inherits="NTE.NTEx.Web.App.ItemMaster.CompanyItemReference" Title="Item Reference" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphMain" runat="server">
<center><asp:Label ID="Label1" CssClass="NormalTextBold" runat="server" ></asp:Label></center>
       <telerik:RadGrid ID="RadGrid1" Skin="Web20" runat="server" Width="100%" AutoGenerateColumns="False" HorizontalAlign="Right"
            BorderStyle="None" BorderWidth="0px" CellPadding="0" CellSpacing="0" ItemStyle-Height="10px" HeaderStyle-Height="10px"
            OnNeedDataSource="RadGrid1_NeedDataSource" 
            OnDeleteCommand="RadGrid1_DeleteCommand"
            OnInsertCommand="RadGrid1_InsertCommand"
            OnUpdateCommand="RadGrid1_UpdateCommand"
            OnItemDataBound="RadGrid1_ItemDataBound"
            PageSize="20" AllowSorting="True" AllowMultiRowSelection="False" AllowPaging="True" GridLines="Horizontal" ShowStatusBar="false">
            <PagerStyle Mode="NumericPages"></PagerStyle>
            <ClientSettings AllowExpandCollapse="True">
               <Resizing AllowColumnResize="true" ResizeGridOnColumnResize="false" AllowRowResize="true" />
            </ClientSettings
            <MasterTableView CommandItemDisplay="Top" AllowFilteringByColumn="True" DataKeyNames="item_id" AllowMultiColumnSorting="True"
                HierarchyLoadMode="ServerOnDemand" Width="100%" HierarchyDefaultExpanded="False" runat="server" 
                Name="Item">
                <DetailTables>
                    <telerik:GridTableView AllowPaging="false" CommandItemDisplay="Top" DataKeyNames="id" Width="80%" runat="server" Name="Reference">
                        <ParentTableRelation>
                            <telerik:GridRelationFields DetailKeyField="item_id" MasterKeyField="item_id" />
                        </ParentTableRelation>
                        <Columns>
                            <telerik:GridEditCommandColumn Resizable="false" HeaderStyle-Width="30px" ItemStyle-Width="30px" UniqueName="EditCommandColumn"></telerik:GridEditCommandColumn>
                            <telerik:GridBoundColumn ReadOnly="true" visible="false" UniqueName="id" HeaderText="Detail ID"
                                DataField="id">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn ReadOnly="true" visible="false" UniqueName="Item_ID" HeaderText="Item ID"
                                DataField="item_id">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn ReadOnly="true" visible="false" UniqueName="HoldReferenceType"
                                DataField="reference_type">
                            </telerik:GridBoundColumn>
                            <telerik:GridDropDownColumn 
                                UniqueName="DDReferenceType" SortExpression="display_name" 
                                ListTextField="display_name" EnableEmptyListItem = "true" EmptyListItemText="--Choose an option--" EmptyListItemValue=""
                                ListValueField ="Reference_Type" HeaderText="Reference Type" DataField="reference_type">
                            </telerik:GridDropDownColumn>                            
                            <telerik:GridBoundColumn ReadOnly="true" UniqueName="reference_name" HeaderText="Name"
                                DataField="reference_name">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn UniqueName="reference_value" HeaderText="Value"
                                DataField="reference_value">
                            </telerik:GridBoundColumn>
                                    <telerik:GridButtonColumn ConfirmText="Delete this Item?" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn1">
                                        <HeaderStyle Width="20px" />
                                        <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                                    </telerik:GridButtonColumn>
                  </Columns>
                        <SortExpressions>
                            <telerik:GridSortExpression FieldName="reference_name"></telerik:GridSortExpression>
                        </SortExpressions>
                   </telerik:GridTableView>
                </DetailTables>
                <Columns>
                  <telerik:GridBoundColumn ReadOnly="true" visible="false" UniqueName="item_id" HeaderText="item_ID" 
                        DataField="item_id">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn ReadOnly="true" visible="false" UniqueName="MemNo" HeaderText="Member" 
                        DataField="Mem_No">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn ReadOnly="true" visible="false" UniqueName="GroupID" HeaderText="Community" 
                        DataField="Group_Id">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn ReadOnly="true" visible="false" UniqueName="type" 
                        HeaderText="Type"
                        DataField="owner_reference_type">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="reference" 
                        HeaderText="Product ID" FilterControlWidth="50px"
                        HeaderStyle-Width="100px" ItemStyle-Width="100px"
                        DataField="owner_reference_value">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="Commodity" 
                        HeaderText="Commodity" ReadOnly="true"
                        ShowFilterIcon="false" FilterControlAltText="Enter a commodity and hit return" FilterControlWidth="20px" AutoPostBackOnFilter="true"
                        HeaderStyle-Width="30px" ItemStyle-Width="30px"
                        DataField="Commodity_code">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn ReadOnly="true" UniqueName="UPC" 
                        HeaderText="UPC" Resizable="true" 
                         HeaderStyle-Width="120px" ItemStyle-Width="120px"
                       DataField="UPC">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn ReadOnly="true" UniqueName="GTIN" 
                        HeaderText="GTIN"
                        HeaderStyle-Width="120px" ItemStyle-Width="120px"
                        DataField="GTIN">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn ReadOnly="true" UniqueName="Branch" 
                        HeaderText="Branch" 
                        ShowFilterIcon="false" FilterControlAltText="Enter a branch and hit return" FilterControlWidth="20px" AutoPostBackOnFilter="true"
                        HeaderStyle-Width="30px" ItemStyle-Width="30px"
                        DataField="Branch">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn ReadOnly="true" UniqueName="Description" 
                        HeaderText="Description" AllowFiltering="false"
                        DataField="Description">
                    </telerik:GridBoundColumn>
                    <telerik:GridButtonColumn ConfirmText="Delete this Item?" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn1">
                         <HeaderStyle Width="20px" />
                         <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                    </telerik:GridButtonColumn>
               </Columns>
                        <SortExpressions>
                            <telerik:GridSortExpression FieldName="owner_reference_value"></telerik:GridSortExpression>
                        </SortExpressions>
            </MasterTableView>
        </telerik:RadGrid>
</asp:Content>

Here is my ASPX C# code:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NTE.NTEx.Web.Common;
using NTE.NTEx.BusinessLogic;
using Telerik.Web.UI;
using SubSonic; //Query Object
using NTE.NTEx.Data;
using NTE.NTEx.Web.Session;
using NTE.NTEx.DataAccessObjects;
using NTE.NTEx.Security;
using System.Text;
  
namespace NTE.NTEx.Web.App.ItemMaster
{
    [Page("Item References", Description = "Item References")]
    public partial class CompanyItemReference : BasePage
    {
        private void Page_Load(object sender, System.EventArgs e)
        {
           if (!Page.IsPostBack)//first time hit page
            {
                SetData("MemNo", Request.QueryString["MemNo"]);
                SetData("GroupID", Request.QueryString["GroupID"]);
                SetData("ReadOnly", Request.QueryString["ReadOnly"]);
                if (string.IsNullOrEmpty(Data["WHERE"]) == true
                {
                    SetWhereClause();
                }
            }
        }
        protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            LoadData();
        }
  
        private void SetWhereClause()
        {
            StringBuilder strSQL = new StringBuilder();
            DbParams parameters = new DbParams();
  
            strSQL.Append(" Select get_mem_group_filter (:1, :2, 'mem_no','group_id') where_clause from ntex_session" );
            parameters.Add("1", Data["MemNo"]);
            parameters.Add("2", Data["GroupId"]);
  
            DataSet ds = DataHelper.FetchData(strSQL.ToString(), parameters);
            SetData("WHERE", (string) ds.Tables[0].Rows[0]["where_clause"]);
        }
  
        private void LoadData()
        {
            StringBuilder strSQL = new StringBuilder();
            //Category Query
            DbParams parameters = new DbParams();
  
            strSQL.Append(" select * from company_item2");
            strSQL.Append(" where mem_no = :1 ");
            strSQL.Append(Data["Where"]);
            parameters.Add("1", Data["MemNo"]);
            DataSet ds = DataHelper.FetchData(strSQL.ToString(), parameters);
  
            RadGrid1.AutoGenerateColumns = false;
            RadGrid1.DataSource = ds.Tables[0];
            RadGrid1.MasterTableView.DataSource = ds.Tables[0];
              
            strSQL.Remove(0, strSQL.Length);
            parameters.Clear();
  
            strSQL.Append(" select * from company_item");
            strSQL.Append(" where mem_no = :1 ");
            strSQL.Append(Data["Where"]);
            parameters.Add("1", Data["MemNo"]);
  
            ds = DataHelper.FetchData(strSQL.ToString(), parameters);
  
            RadGrid1.AutoGenerateColumns = false;
            RadGrid1.MasterTableView.DetailTables[0].DataSource = ds.Tables[0];
        }
        protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            string tableName = e.Item.OwnerTableView.Name.ToString();
            if (e.Item is GridEditableItem && (e.Item as GridEditableItem).IsInEditMode && tableName=="Reference")
            {
                GridEditableItem editedItem = e.Item as GridEditableItem;
                GridEditManager editMan = editedItem.EditManager;
                StringBuilder strSQL = new StringBuilder();
  
                strSQL.Append(" select a.reference_type, a.display_name from reference_master_type a where reference_master_id = to_number(getcontextattribute('"+Data["MemNo"]+"',"+Data["GroupId"]+",'REFMSTRID'))");
                DataSet ds = DataHelper.FetchData(strSQL.ToString());
                //
                GridDropDownListColumnEditor editor = editMan.GetColumnEditor("DDReferenceType") as GridDropDownListColumnEditor;
                //in case you have RadComboBox editor for the GridDropDownColumn (this is the default editor),         
                //you will need to use ComboBoxControl below instead of DropDownListControl
                //Then you can modify the list control as per your custom conventions
                editor.DataSource = ds.Tables[0];
                editor.DataBind();
                //editor.Visible = true;
                //editor.ComboBoxControl.SelectedValue = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["id"].ToString();
                //And so on
            }
        }
        protected void RadGrid1_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            //Get the GridEditableItem of the RadGrid  
            string tableName = e.Item.OwnerTableView.Name.ToString();
            GridEditableItem editedItem = e.Item as GridEditableItem;
            //try
            //{
                switch (tableName)
                {
                    case "Item":
                        {
                            string str_Reference = (editedItem["reference"].Controls[0] as TextBox).Text;
                            ItemCollection colIC = new ItemCollection();
                            Query qry = new Query(Item.Schema);
                            qry.AddWhere("owner_reference", str_Reference);
                            colIC.LoadAndCloseReader (qry.ExecuteReader());
                            if (colIC.Count == 1)
                            {
                                ItemCorporationUsageCollection colICU = new ItemCorporationUsageCollection();
                                qry = new Query(ItemCorporationUsage.Schema);
                                qry.AddWhere("item_id", colIC[0].Id).AND("related_corporation_id", int.Parse(Data["MemNo"]));
                                colICU.LoadAndCloseReader (qry.ExecuteReader());
  
                                if (colICU.Count == 0)
                                {
                                    DataAccessObjects.ItemCorporationUsage oICU;
                                    oICU = new ItemCorporationUsage();
                                    oICU.RelatedCorporationId = int.Parse(Data["MemNo"]);
                                    oICU.ItemId = colIC[0].Id;
                                    oICU.Save();
                                }
                            }
                            LoadData();
                            DisplayMessage("Add Successfull.");
                            break;
                        }
                    case "Reference":
                        {
                            int itemid = int.Parse(editedItem.OwnerTableView.ParentItem.OwnerTableView.DataKeyValues[editedItem.OwnerTableView.ParentItem.ItemIndex]["item_id"].ToString());
                            DropDownList list = editedItem.FindControl("DDReferenceType") as DropDownList;
                            Response.Write(list.Items.Count +"<BR>");
                            Response.Write(editedItem["DDReferenceType"].Controls[0].ToString());
                            DataAccessObjects.ItemCorporationReference oICR;
                            oICR = new ItemCorporationReference();
                            oICR.RelatedCorporationId = int.Parse(Data["MemNo"]);
                            oICR.ItemId = itemid;
                            //oICR.ReferenceType = (editedItem.FindControl("DDReferenceType") as DropDownList).SelectedItem.Value;
                            oICR.Reference = (editedItem["reference_value"].Controls[0] as TextBox).Text;
                            //oICR.Save();
                            //LoadData();
                            DisplayMessage("Insert Successfull.");
                            break;
                        }
                }
            //}
            //catch
            //{
            //    Response.Write("Error: Parameter could not be saved.");
            //}
        }
        protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.CommandName == RadGrid.EditCommandName)
            {
                Response.Write("Primary key for the clicked item from ItemCommand: " + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["item_id"] + "<br>");
                Response.Write("Item Index for the clicked item from ItemCommand: " + e.Item.ItemIndex + "<br>");
                DisplayMessage("Table Name clicked item from ItemCommand: " + e.Item.OwnerTableView.Name.ToString() + "<br>");
            }
        }
        protected void RadGrid1_DeleteCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            //Get the GridEditableItem of the RadGrid  
            GridEditableItem editedItem = e.Item as GridEditableItem;
            string tableName = e.Item.OwnerTableView.Name.ToString();
            try
            {
                switch (tableName)
                {
                    case "Item":
                        {
                            int ItemID = int.Parse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["item_id"].ToString());
                            Query qry = new Query(ItemCorporationReference.Schema);
                            qry.QueryType = QueryType.Delete;
                            qry.AddWhere("item_id", ItemID).AND("related_corporation_id", int.Parse(Data["MemNo"]));
                            qry.Execute();
  
                            qry = new Query(ItemCorporationUsage.Schema);
                            qry.QueryType = QueryType.Delete;
                            qry.AddWhere("item_id", ItemID).AND("related_corporation_id", int.Parse(Data["MemNo"]));
                            qry.Execute();
  
                            LoadData();
                            DisplayMessage("Delete Successfull.");
                            break;
                        }
                    case "Reference":
                        {
                            int DeleteID = int.Parse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["id"].ToString());
                            DataAccessObjects.ItemCorporationReference.Delete(DeleteID);
                            DisplayMessage("Delete Successfull.");
                            break;
                        }
                }
            }
            catch
            {
                DisplayMessage("Error: Parameter could not be saved.");
            }
        }
        protected void RadGrid1_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            //Get the GridEditableItem of the RadGrid  
            GridEditableItem editedItem = e.Item as GridEditableItem;
            string tableName = e.Item.OwnerTableView.Name.ToString();
            try
            {
                switch (tableName)
                {
                    case "Item":
                        {
                            break;
                        }
                    case "Reference":
                        {
                            int UpdateID = int.Parse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["id"].ToString());
                            DataAccessObjects.ItemCorporationReference oICR;
                            oICR = new ItemCorporationReference(UpdateID);
                            oICR.ReferenceType = (editedItem["DDReferenceType"].Controls[0] as DropDownList).SelectedItem.Value;
                            oICR.Reference = (editedItem["reference_value"].Controls[0] as TextBox).Text;
                            oICR.Save();
                            DisplayMessage("Delete Successfull.");
                            break;
                        }
                }
            }
            catch
            {
                DisplayMessage("Error: Parameter could not be saved.");
            }
        }
        private void DisplayMessage(string text)
        {
            RadGrid1.Controls.Add(new LiteralControl(string.Format("<span style='color:red'>{0}</span>", text)));
        }
    }
}
Marin
Telerik team
 answered on 12 Oct 2010
3 answers
109 views
I'm new to using WCF and LINQ. I'm attempting to shoehorn the example from this link:

http://demos.telerik.com/aspnet-ajax/combobox/examples/loadondemand/wcf/defaultcs.aspx

into an application Im putting together as a learning excercise.

Ive verified ( using a packet sniffer, and decoding the HTTP traffic) that the results from the services calls are being sent from the server to the client, however the results do not appear in the combobox.

The svc file looks like:

using

 

 

System;

 

 

using

 

 

System.Collections.Generic;

 

 

using

 

 

System.Data.Linq;

 

 

using

 

 

System.Linq;

 

 

using

 

 

System.Runtime.Serialization;

 

 

using

 

 

System.ServiceModel;

 

 

using

 

 

System.ServiceModel.Activation;

 

 

using

 

 

System.ServiceModel.Web;

 

 

using

 

 

System.Text;

 

 

using

 

 

System.Web.Services;

 

 

using

 

 

Telerik.Web.UI;

 

 

namespace

 

 

QUARK.webservices

 

{

[

 

 

ServiceContract(Namespace = "")]

 

[

 

 

AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

 

 

 

 

public class strange

 

 

{

[

 

OperationContract]

 

 

 

 

public RadComboBoxData LoadDataTemplates(RadComboBoxContext context)

 

{

 

 

 

RadComboBoxData result = new RadComboBoxData();

 

 

 

 

quarkDataContext quarkdb = new quarkDataContext();

 

 

 

 

var allTemplates = from DEVICE_TYPE in quarkdb.DEVICE_TYPEs

 

 

 

 

orderby DEVICE_TYPE.DESC

 

 

 

 

select new RadComboBoxItemData

 

 

{

Text = DEVICE_TYPE.DESC

};

 

 

string text = context.Text;

 

 

 

 

if (!String.IsNullOrEmpty(text))

 

{

allTemplates = allTemplates.Where(item => item.Text.StartsWith(text));

}

 

 

 

int numberOfItems = context.NumberOfItems;

 

 

 

 

var templates2 = allTemplates.Skip(numberOfItems).Take(10);

 

result.Items = templates2.ToArray();

 

 

 

int endOffset = numberOfItems + templates2.Count();

 

 

 

 

int totalCount = allTemplates.Count();

 

 

 

 

if (endOffset == totalCount)

 

result.EndOfItems =

 

 

true;

 

result.Message =

 

 

String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>",

 

endOffset, totalCount);

 

 

 

return result;

 

}

}

}

 



and my combobox in the aspx looks like:

<

 

 

telerik:RadComboBox ID="drp_hosttemplate" Runat="server"

 

 

 

 

Skin="Web20" Width="177px" EnableLoadOnDemand="True"

 

 

 

 

EnableVirtualScrolling="True" ShowMoreResultsBox="True"

 

 

 

 

EnableItemCaching="True" >

 

 

 

 

<WebServiceSettings Method="LoadDataTemplates" Path="webservices/strange.svc" />

 

 

 

 

<ExpandAnimation Type="InOutElastic" />

 

 

 

 

<CollapseAnimation Type="InOutElastic" />

 

 

 

 

</telerik:RadComboBox>

 

 



Simon
Telerik team
 answered on 12 Oct 2010
1 answer
57 views
Hi

When pasting the same word content from different clients, then result is not the same.
Ex the span tags is not removed etc..

The Clients is
Windows XP, IE8, MS Word is not installed (copy past via Terminal Client). Fails.
Windows 7, IE8, MS Word 2007. Ok result

What can be the reason ?, and is there a way to unify this process.

Please contact me if you need futher information,

/Erik K




Rumen
Telerik team
 answered on 12 Oct 2010
12 answers
213 views

I’m using a web service to feed the search as you type combo box on my page.  If the search returns 0 results I get the following error:

 

Microsoft Jscript runtime error: ‘Items’ is null or not an object

 

It works fine if results are returned.  Below is the code for the RadComboBox and below that is the web service method I’m using.  Any assistance would be greatly appreciated.

 

Experienced this problem with both 2010 Q1 and now Q2 Beta.

 

RadComboBox Snippet:

<telerik:RadComboBox ID="rcmbClients" runat="server" EnableLoadOnDemand="true"
    ShowMoreResultsBox="true" EnableVirtualScrolling="true"
    TabIndex="1" EnableItemCaching="true" EnableViewState="false" EmptyMessage="-- enter text --"
    NoWrap="true" ShowWhileLoading="false"
    OnSelectedIndexChanged="rcmbClients_SelectedIndexChanged"
    AutoPostBack="true" Width="500" WebServiceSettings-Method="GetFilteredClients"
    Filter="Contains" ItemRequestTimeout="300" WebServiceSettings-Path="~/RadService.svc"
    AllowCustomText="true">
</telerik:RadComboBox>  

 

Web Service Snippet:

[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class RadService
{
  [OperationContract]
  public RadComboBoxData GetFilteredClients(RadComboBoxContext context)
  {
      try
      {
             
         RadComboBoxData result = new RadComboBoxData();
         ClientBL clientBL = new ClientBL();
         IList<ShortClient> clients = clientBL.GetFilteredShortClients(context.Text.Replace("%""[%]").Replace("&squote""[']"));
         IEnumerable<RadComboBoxItemData> allDataItems = from client in clients
                                                         select new RadComboBoxItemData()
                                                         {
                                                             Text = client.DisplayName,
                                                             Value = client.ID.ToString()
                                                         };
         int numberOfItems = context.NumberOfItems;
         IEnumerable<RadComboBoxItemData> pageOfDataItems = allDataItems.Skip(numberOfItems).Take(500);
         result.Items = pageOfDataItems.ToArray();
         int endOffSet = numberOfItems + pageOfDataItems.Count();
         int totalCount = allDataItems.Count();
         if (endOffSet == totalCount)
             result.EndOfItems = false;
         result.Message = String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffSet, totalCount);
         return result;
     }
     catch (Exception ex)
     {
         string target = context.Text;
         LogManager logManager = new LogManager();
         logManager.Log(TraceEventType.Error, "Search Criteria Submitted By User: \"" + context.Text + "\""  + Environment.NewLine + ex.Message.ToString());
         throw;
     }
}
Simon
Telerik team
 answered on 12 Oct 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?