Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
179 views
Hello,

I am trying to add more than one of the type ahead controls here:
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridincombobox/defaultcs.aspx?product=combobox


I can get a single one to work but for some reason when I try and add the second I cannot get it to populate with data.  Funny thing is it is exactly the same as the first one.  I can see the columns, it pulls up, looks like it binds but never fills with data.  I have tried a number of things to get it to work without issue.  I will include my latest iteration of attempting to get this to work below.  What am i doing wrong?

Thanks.


<%@ Page Title="" Language="C#" MasterPageFile="~/nestLeftNav.master" AutoEventWireup="true" CodeBehind="SKUEditor.aspx.cs" Inherits="PriceTag.SKUEditor" EnableEventValidation="false" %>
 
<%--<%@ Register TagPrefix="ebtc" Src="~/controls/skuEditor.ascx" TagName="sku" %>--%>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<%@ MasterType VirtualPath="~/nestLeftNav.Master" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="nesthead" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="nestTopNav" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="nestLeftNavigation" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="nestMain" runat="server">
 
    <telerik:RadCodeBlock ID="rcb1" runat="server">
        <script type="text/javascript">
            var grid;
            var gridPrint;
 
            function GridCreated(sender, args) {
                grid = sender;
            }
 
            function GridPrintCreated(sender, args) {
                gridPrint = sender;
            }
 
            function RowClicked(sender, args) {
 
                //fetch the order id, product name and unit price values from the grid and set them as text in the combobox' input
                var cellValues = args.getDataKeyValue("ItemCode") + ", " + args.getDataKeyValue("Description");
                var combo = $find("<%= rcmbSKU.ClientID %>");
                setTimeout(function () {
                    combo.set_text(cellValues);
                }, 50);
            }
 
            function RowClickedPrintWithSKU(sender, args) {
 
                //fetch the order id, product name and unit price values from the grid and set them as text in the combobox' input
                var cellValues = args.getDataKeyValue("ItemCode") + ", " + args.getDataKeyValue("Description");
                var combo = $find("<%= rcmbPrintWithSKU.ClientID %>");
                setTimeout(function () {
                    combo.set_text(cellValues);
                }, 50);
            }
 
            function ShouldInitiateAjaxRequest(comboText) {
 
                //if there are three or more symbols entered, filter the data in the dropdown grid
                if (comboText.length > 2) {
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("LoadFilteredData");
                    return true;
                }
                else {
                    return false;
                }
            }
 
            function ShouldInitiateAjaxRequestPrint(comboText) {
 
                //if there are three or more symbols entered, filter the data in the dropdown grid
                if (comboText.length > 2) {
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("PrintLoadFilteredData");
                    return true;
                }
                else {
                    return false;
                }
            }
 
            function HandleOpen(sender, args) {
 
                var flag = ShouldInitiateAjaxRequest(sender.get_text());
 
                //cancel the dropdown opening if less than three characters are entered in the combobox' input
                if (!flag) {
                    args.set_cancel(true);
                }
            }
 
            function HandleOpenPrint(sender, args) {
 
                var flag = ShouldInitiateAjaxRequestPrint(sender.get_text());
 
                //cancel the dropdown opening if less than three characters are entered in the combobox' input
                if (!flag) {
                    args.set_cancel(true);
                }
            }
 
            function HandleKeyPressed(sender) {
                var combo = $find(sender.id);
                combo.showDropDown();
            }
        </script>
    </telerik:RadCodeBlock>
 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest" RequestQueueSize="3">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="ddlVendor">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="ddlVendorCollections" LoadingPanelID="rajaxLoading" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="ddlVendorCollections">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="txtPriceTagDescr" LoadingPanelID="rajaxLoading" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="rgridCollections">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="pnlSuccess" LoadingPanelID="rajaxLoading" />
                    <telerik:AjaxUpdatedControl ControlID="pnlError" LoadingPanelID="rajaxLoading" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
 
    <telerik:RadAjaxLoadingPanel ID="rajaxLoading" runat="server">
    </telerik:RadAjaxLoadingPanel>
 
 
    <div class="span12">
        <div class="page-header">
            <h2>SKU Editor</h2>
        </div>
 
        <div class="category-select">
            <div class="control-group">
                <label class="control-label" for="rcmbSKU">SKU:</label>
                <div class="controls">
 
                    <telerik:RadComboBox ID="rcmbSKU" Width="340px" runat="server" MarkFirstMatch="True" CssClass="SKUCombo" EnableEmbeddedBaseStylesheet="true" EnableEmbeddedSkins="false"
                                         AllowCustomText="True" OnClientDropDownOpening="HandleOpen" ExpandAnimation-Type="None"
                                         CollapseAnimation-Type="None" DropDownWidth="340px" onkeyup="HandleKeyPressed(this)">
                        <ItemTemplate>
                            <telerik:RadGrid ID="rgridSKU" Width="325px" runat="server" OnSelectedIndexChanged="rgridSKU_OnSelectedIndexChanged" OnNeedDataSource="rgridSKU_NeedDataSource" EnableEmbeddedBaseStylesheet="true" EnableEmbeddedSkins="true">
                                <MasterTableView NoMasterRecordsText="" AutoGenerateColumns="False" DataKeyNames="ItemCode, ItemKey, Description"
                                                 Width="100%" ClientDataKeyNames="ItemCode, ItemKey, Description" TableLayout="Fixed">
                                    <Columns>
                                        <telerik:GridBoundColumn HeaderText="SKU" DataField="ItemCode" UniqueName="ItemCode">
                                            <HeaderStyle Width="90px"></HeaderStyle>
                                        </telerik:GridBoundColumn>
 
                                        <telerik:GridBoundColumn HeaderText="Description" DataField="Description" UniqueName="Description">
                                            <HeaderStyle Width="215px"></HeaderStyle>
                                        </telerik:GridBoundColumn>
                                    </Columns>
                                </MasterTableView>
                                <ClientSettings>
                                    <ClientEvents OnRowClick="RowClicked" OnGridCreated="GridCreated"></ClientEvents>
                                    <Scrolling AllowScroll="true" UseStaticHeaders="true" ScrollHeight="300px"></Scrolling>
                                </ClientSettings>
                            </telerik:RadGrid>
                        </ItemTemplate>
                        <Items>
                            <telerik:RadComboBoxItem runat="server" Text=" "></telerik:RadComboBoxItem>
                        </Items>
                    </telerik:RadComboBox>
 
                </div>
            </div>
        </div>
 
       
        
 
        <div class="category-select">
            <div class="control-group">
                <label class="control-label" for="ddlVendor">Vendor:</label>
                <div class="controls">
                    <asp:DropDownList ID="ddlVendor" runat="server" AutoPostBack="true"
                                      onselectedindexchanged="ddlVendor_SelectedIndexChanged"  />
                </div>
            </div>
        </div>
 
        <div class="category-select">
            <div class="control-group">
                <label class="control-label" for="ddlVendorCollections">Vendor Collections:</label>
                <div class="controls">
                    <asp:DropDownList ID="ddlVendorCollections" runat="server" AutoPostBack="true"
                                      onselectedindexchanged="ddlVendorCollections_SelectedIndexChanged"  />
                </div>
            </div>
        </div>
 
        <div class="category-select">
            <div class="control-group">
                <label class="control-label" for="ddlHeadline">Headline:</label>
                <div class="controls">
                    <asp:DropDownList ID="ddlHeadline" runat="server" AutoPostBack="true" />
                </div>
            </div>
        </div>
 
         <div class="category-select">
            <div class="control-group">
                <label class="control-label" for="txtPriceTagDescr">Price Tag Description: </label>
                <asp:TextBox ID="txtPriceTagDescr" runat="server"></asp:TextBox>
 
            </div>
        </div>
 
 
 
 
        <div class="category-select">
            <div class="control-group">
                <label class="control-label" for="rcmbSKU">SKU:</label>
                <div class="controls">
 
                    <telerik:RadComboBox ID="RadComboBox1" Width="340px" runat="server" MarkFirstMatch="True" CssClass="SKUCombo" EnableEmbeddedBaseStylesheet="true" EnableEmbeddedSkins="false"
                                         AllowCustomText="True" OnClientDropDownOpening="HandleOpen" ExpandAnimation-Type="None"
                                         CollapseAnimation-Type="None" DropDownWidth="340px" onkeyup="HandleKeyPressed(this)">
                        <ItemTemplate>
                            <telerik:RadGrid ID="rgridSKU" Width="325px" runat="server" OnSelectedIndexChanged="rgridSKU_OnSelectedIndexChanged" OnNeedDataSource="rgridSKU_NeedDataSource" EnableEmbeddedBaseStylesheet="true" EnableEmbeddedSkins="true">
                                <MasterTableView NoMasterRecordsText="" AutoGenerateColumns="False" DataKeyNames="ItemCode, ItemKey, Description"
                                                 Width="100%" ClientDataKeyNames="ItemCode, ItemKey, Description" TableLayout="Fixed">
                                    <Columns>
                                        <telerik:GridBoundColumn HeaderText="SKU" DataField="ItemCode" UniqueName="ItemCode">
                                            <HeaderStyle Width="90px"></HeaderStyle>
                                        </telerik:GridBoundColumn>
 
                                        <telerik:GridBoundColumn HeaderText="Description" DataField="Description" UniqueName="Description">
                                            <HeaderStyle Width="215px"></HeaderStyle>
                                        </telerik:GridBoundColumn>
                                    </Columns>
                                </MasterTableView>
                                <ClientSettings>
                                    <ClientEvents OnRowClick="RowClicked" OnGridCreated="GridCreated"></ClientEvents>
                                    <Scrolling AllowScroll="true" UseStaticHeaders="true" ScrollHeight="300px"></Scrolling>
                                </ClientSettings>
                            </telerik:RadGrid>
                        </ItemTemplate>
                        <Items>
                            <telerik:RadComboBoxItem runat="server" Text=" "></telerik:RadComboBoxItem>
                        </Items>
                    </telerik:RadComboBox>
 
                </div>
            </div>
        </div>
 
 
 
 
 
 
 
 
        <div class="category-select">
            <div class="control-group">
                <label class="control-label" for="rcmbPrintWithSKU">Print with SKU</label>
                <div class="controls">
 
                    <telerik:RadComboBox ID="rcmbPrintWithSKU" Width="340px" runat="server" MarkFirstMatch="True" CssClass="SKUCombo" EnableEmbeddedBaseStylesheet="true" EnableEmbeddedSkins="false"
                                         AllowCustomText="True" OnClientDropDownOpening="HandleOpenPrint" ExpandAnimation-Type="None"
                                         CollapseAnimation-Type="None" DropDownWidth="340px" onkeyup="HandleKeyPressed(this)">
                        <ItemTemplate>
                            <telerik:RadGrid ID="rgridPrintWithSKU" Width="325px" runat="server" OnSelectedIndexChanged="rgridPrintWithSKU_OnSelectedIndexChanged" OnNeedDataSource="rgridPrintWithSKU_NeedDataSource"
                            EnableEmbeddedBaseStylesheet="true" EnableEmbeddedSkins="true">
                                <MasterTableView NoMasterRecordsText="" AutoGenerateColumns="False" DataKeyNames="ItemCode, ItemKey, Description"
                                                 Width="100%" ClientDataKeyNames="ItemCode, ItemKey, Description" TableLayout="Fixed">
                                    <Columns>
                                        <telerik:GridBoundColumn HeaderText="SKU" DataField="ItemCode" UniqueName="ItemCode">
                                            <HeaderStyle Width="90px"></HeaderStyle>
                                        </telerik:GridBoundColumn>
 
                                        <telerik:GridBoundColumn HeaderText="Description" DataField="Description" UniqueName="Description">
                                            <HeaderStyle Width="215px"></HeaderStyle>
                                        </telerik:GridBoundColumn>
                                    </Columns>
                                </MasterTableView>
                                <ClientSettings>
                                    <ClientEvents OnRowClick="RowClickedPrintWithSKU" OnGridCreated="GridPrintCreated"></ClientEvents>
                                    <Scrolling AllowScroll="true" UseStaticHeaders="true" ScrollHeight="300px"></Scrolling>
                                </ClientSettings>
                            </telerik:RadGrid>
                        </ItemTemplate>
                        <Items>
                            <telerik:RadComboBoxItem runat="server" Text=" "></telerik:RadComboBoxItem>
                        </Items>
                    </telerik:RadComboBox>
 
                </div>
            </div>
        </div>
 
 
 
          <div class="category-select">
            <div class="control-group">
                <div class="controls">
                     
                    <asp:Button ID="btnSave" runat="server" Text="Button" OnClick="btnSave_OnClick" />
 
                </div>
            </div>
        </div>
 
    </div>
 
</asp:Content>



using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
using System.Configuration;
using Database;
 
namespace PriceTag
{
    public partial class SKUEditor : PriceTag.classes.ConlinsBasePage
    {
        public Database.VendorCollection _dsVendorCollections
        {
            get
            {
                if (ViewState["VendorCollection"] != null)
                {
                    return (Database.VendorCollection)ViewState["VendorCollection"];
                }
                else
                {
                    return null;
                }
            }
            set { ViewState["VendorCollection"] = value; }
        }
 
 
        public Header parentMasterPage
        {
            get { return (Master.parentMaster as Header); }
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
            RadGrid grid = rcmbSKU.Items[0].FindControl("rgridSKU") as RadGrid;
            RadAjaxManager1.AjaxSettings.AddAjaxSetting(RadAjaxManager1, grid, rajaxLoading);
 
            if (!IsPostBack)
            {
                fillVendorDropDown();
                fillHeadlineCombo();
            }
        }
 
 
        protected DataTable fillItemSKUCombo()
        {
            try
            {
                Database.Item ds = new Item();
                Database.ItemTableAdapters.ItemTableAdapter ta = new Database.ItemTableAdapters.ItemTableAdapter();
                ta.Fill(ds._Item, rcmbSKU.Text);
                //RadComboBox1.DataSource = ds._Item;
                //RadComboBox1.DataValueField="ItemCode";
                //RadComboBox1.DataBind();
                return ds._Item;
            }
            catch (Exception ex)
            {
 
                throw new System.Exception("There was an issue" + ex.ToString());
 
            }
        }
 
        protected DataTable fillItemPrintWithSKUCombo()
        {
            try
            {
                Database.Item ds = new Item();
                Database.ItemTableAdapters.ItemTableAdapter ta = new Database.ItemTableAdapters.ItemTableAdapter();
                ta.Fill(ds._Item, rcmbPrintWithSKU.Text);
                //RadComboBox1.DataSource = ds._Item;
                //RadComboBox1.DataValueField="ItemCode";
                //RadComboBox1.DataBind();
                return ds._Item;
            }
            catch (Exception ex)
            {
 
                throw new System.Exception("There was an issue" + ex.ToString());
 
            }
        }
 
        protected void rgridSKU_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            RadGrid grid = source as RadGrid;
            if (rcmbSKU.Text != "")
            {
                //split the combobox text and filter the records in the grid based on the first value in the array, i.e. OrderID
                String[] vals = rcmbSKU.Text.Split(',');
                if (vals.Length > 0)
                {
                    rcmbSKU.Text = vals[0];
                }
                grid.DataSource = fillItemSKUCombo();
                //grid.DataSource = GetDataTable("SELECT [Order Details].OrderID, Products.ProductName, [Order Details].UnitPrice FROM Products, [Order Details] " +
                //"WHERE [Order Details].OrderID LIKE '" + RadComboBox1.Text + "%'" + " AND Products.ProductID=[Order Details].ProductID");
            }
            else
            {
                DataTable dt = new DataTable();
                dt.Columns.Add("ItemCode");
                dt.Columns.Add("Description");
                //dt.Columns.Add("ProductName");
                //dt.Columns.Add("UnitPrice");
                grid.DataSource = dt;
            }
        }
 
        protected void rgridPrintWithSKU_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            RadGrid gridPrint = source as RadGrid;
 
            if (rcmbPrintWithSKU.Text != "")
            {
                //split the combobox text and filter the records in the grid based on the first value in the array, i.e. OrderID
                String[] vals = rcmbPrintWithSKU.Text.Split(',');
                if (vals.Length > 0)
                {
                    rcmbPrintWithSKU.Text = vals[0];
                }
                gridPrint.DataSource = fillItemPrintWithSKUCombo();
                //grid.DataSource = GetDataTable("SELECT [Order Details].OrderID, Products.ProductName, [Order Details].UnitPrice FROM Products, [Order Details] " +
                //"WHERE [Order Details].OrderID LIKE '" + RadComboBox1.Text + "%'" + " AND Products.ProductID=[Order Details].ProductID");
            }
            else
            {
                DataTable dt = new DataTable();
                dt.Columns.Add("ItemCode");
                dt.Columns.Add("Description");
                //dt.Columns.Add("ProductName");
                //dt.Columns.Add("UnitPrice");
                gridPrint.DataSource = dt;
            }
        }
 
        
        protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
 
            RadGrid gridPrint = rcmbPrintWithSKU.Items[0].FindControl("rgridPrintWithSKU") as RadGrid;
            //detect the filter action
            if (e.Argument.IndexOf("PrintLoadFilteredData") != -1)
            {
                gridPrint.Rebind();
            }
 
 
            RadGrid grid = rcmbSKU.Items[0].FindControl("rgridSKU") as RadGrid;
            //detect the filter action
            if (e.Argument.IndexOf("LoadFilteredData") != -1)
            {
                grid.Rebind();
            }
        }
 
         
 
        protected void ddlVendor_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                fillVendorCollectionDropDown();
                searchForItemAttributes();
            }
            catch (Exception ex)
            {
                this.parentMasterPage.showError(ex.ToString());
            }
        }
 
        protected void ddlVendorCollections_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                searchForItemAttributes();
            }
            catch (Exception ex)
            {
 
                this.parentMasterPage.showError("There was an issue when getting the selected Vendor collection value. " + ex.ToString());
            }
        }
 
        protected void searchForItemAttributes()
        {
            try
            {
                string[] strItemCode = rcmbSKU.Text.Split(Convert.ToChar(","));
 
                if (strItemCode.Length > 0)
                {
                    Database.sp_ItemAttributes_Select ds = new sp_ItemAttributes_Select();
                    Database.sp_ItemAttributes_SelectTableAdapters.ItemAttributes_SelectTableAdapter ta = new Database.sp_ItemAttributes_SelectTableAdapters.ItemAttributes_SelectTableAdapter();
                    ta.Fill(ds.ItemAttributes_Select, strItemCode[0], Convert.ToInt32(ddlVendorCollections.SelectedValue.ToString()));
 
                    if (ds.ItemAttributes_Select.Rows.Count > 0)
                    {
                        txtPriceTagDescr.Text = ds.ItemAttributes_Select.Rows[0]["PriceTagDescription"].ToString();
                    }
                }
            }
            catch (Exception ex)
            {
 
                throw new System.Exception("There was an issue searching for an existing ItemAttribute. " + ex.ToString());
            }
        }
 
        protected void fillVendorCollectionDropDown()
        {
            try
            {
                string strVendorCode = ddlVendor.SelectedValue.ToString();
 
                Database.sp_VendorCollection_Select ds = new sp_VendorCollection_Select();
                Database.sp_VendorCollection_SelectTableAdapters.VendorCollection_SelectTableAdapter ta = new Database.sp_VendorCollection_SelectTableAdapters.VendorCollection_SelectTableAdapter();
                ta.Fill(ds.VendorCollection_Select, strVendorCode);
 
                ddlVendorCollections.DataSource = ds.VendorCollection_Select;
                ddlVendorCollections.DataTextField = "CollectionName";
                ddlVendorCollections.DataValueField = "CollectionKey";
 
                ddlVendorCollections.DataBind();
            }
            catch (Exception ex)
            {
                throw new System.Exception("There was an issue filling the Vendor Collection dropdown. Please contact support or try again.  " + ex.ToString());
            }
        }
 
        protected void fillHeadlineCombo()
        {
            try
            {
 
                Database.sp_Headline_Select ds = new sp_Headline_Select();
                Database.sp_Headline_SelectTableAdapters.Headline_SelectTableAdapter ta = new Database.sp_Headline_SelectTableAdapters.Headline_SelectTableAdapter();
                ta.Fill(ds.Headline_Select);
 
                ddlHeadline.DataSource =ds.Headline_Select;
                ddlHeadline.DataTextField = "Headline";
                ddlHeadline.DataValueField = "HeadlineIdentifier";
 
                ddlHeadline.DataBind();
            }
            catch (Exception ex)
            {
                throw new System.Exception("There was an issue filling the Vendor Collection dropdown. Please contact support or try again.  " + ex.ToString());
            }
        }
 
        protected void fillVendorDropDown()
        {
            try
            {
                Database.sp_Vendor_Select ds = new sp_Vendor_Select();
                Database.sp_Vendor_SelectTableAdapters.Vendor_SelectTableAdapter ta = new Database.sp_Vendor_SelectTableAdapters.Vendor_SelectTableAdapter();
                ta.Fill(ds.Vendor_Select);
 
                ddlVendor.DataSource = ds.Vendor_Select;
                ddlVendor.DataTextField = "Name";
                ddlVendor.DataValueField = "VendorCode";
 
                ddlVendor.DataBind();
 
                if (ds.Vendor_Select.Count > 0)
                {
                    ddlVendor.SelectedIndex = ddlVendor.Items.IndexOf(ddlVendor.Items[0]);
                    fillVendorCollectionDropDown();
                }
            }
            catch (Exception ex)
            {
                throw new System.Exception("There was an issue filling the Vendor dropdown. Please contact support or try again.  " + ex.ToString());
            }
        }
 
        protected void btnSave_OnClick(object sender, EventArgs e)
        {
            try
            {
                string[] strItemCode = rcmbSKU.Text.Split(Convert.ToChar(","));
 
                if (strItemCode.Length>0)
                {
                    Database.sp_ItemAttributes_InsertTableAdapters.QueriesTableAdapter ta = new Database.sp_ItemAttributes_InsertTableAdapters.QueriesTableAdapter();
                    ta.ItemAttributes_Insert(strItemCode[0], txtPriceTagDescr.Text, Convert.ToInt32(ddlVendorCollections.SelectedValue), ddlHeadline.SelectedValue.ToString());
                }
                else
                {
                    throw new System.Exception("You must choose an item code. ");
                }
                this.parentMasterPage.showSuccess("Data was saved successfully. ");
            }
            catch (Exception ex)
            {
 
                this.parentMasterPage.showError("There was an issue saving the changes.  " + ex.ToString());
            }
        }
 
        protected void rgridSKU_OnSelectedIndexChanged(object sender, EventArgs e)
        {
             
        }
 
        protected void rgridPrintWithSKU_OnSelectedIndexChanged(object sender, EventArgs e)
        {
             
        }
         
 
        }
}
Nencho
Telerik team
 answered on 06 Nov 2012
2 answers
92 views
Heey Guys 

Is there an example of how to show a Combo Box item, say "Admin" only when a user acting in the role of administrator is currently logged in?

Thanks for help and fast answer ! `^
Nikola
Top achievements
Rank 2
 answered on 06 Nov 2012
1 answer
196 views

I have a RadScheduler where I use the AdvancedInsertTemplate and AdvancedEditTemplate.

In the AdvancedForm user control I want to show different controls depending on the logged in user is Administrator or a normal user. So I've added a LoginView like this:

<asp:Panel runat="server" ID="AdvancedControlsPanel" CssClass="rsAdvMoreControls">                  
<asp:Panel runat="server">
<%-- RESOURCE CONTROLS --%> 
<ul class="rsResourceControls">
<li>
<asp:LoginView ID="LoginView1" runat="server">
<RoleGroups>
<asp:RoleGroup Roles="Administrator">
<ContentTemplate>
                                              
<!-- Resource controls should follow the convention Res[Resource Name] for ID -->
 <scheduler:ResourceControl runat="server" ID="ResCustomer" Type="Customer" Label="Customer: "
Skin='<%# Owner.Skin %>' />
                                                          
 <telerik:RadComboBox runat="server" ID="EmployeeComboBox" Label="Employee: " Visible="true"
Skin="Outlook" Width="300px" CausesValidation="false" OnClientSelectedIndexChanged="OnClientSelectedIndexChanged"
OnClientLoad="employeeClientLoad">
</telerik:RadComboBox>
                                              
</ContentTemplate>
</asp:RoleGroup>
<asp:RoleGroup Roles="User">
<ContentTemplate>
<asp:Label ID="LabelCustomer" runat="server" Text="CustomerName" />
</ContentTemplate>
</asp:RoleGroup>
</RoleGroups>
</asp:LoginView>
  
...

When compiling I then get an error saying "ResCustomer does not exist in current context":

[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
        public object Customer
        {
            get
            {
                return ResCustomer.Value;
            }
  
            set
            {
                ResCustomer.Value = value;
            }
        }

I then try to access the controls within the LoginView, but I can't find them:

LoginView lv = FindControl("LoginView1") as LoginView;
RadComboBox employeeComboBox = lv.FindControl("EmployeeComboBox") as RadComboBox;
Label customerLabel = lv.FindControl("LabelCustomer") as Label;

But now both the employeeComboBox and the customerLabel are null? The LoginView1 has been found, though.

And how do I find the ResCustomer?

On the page where the RadScheduler is I have a similar scenario, and there the controls within the LoginView are found without any problem.

What am I missing?

Regards, Jill-Connie Lorentsen

Plamen
Telerik team
 answered on 06 Nov 2012
0 answers
126 views


we are  using RadTabStrip in our project.functionality wise its works good.However,its giving me designing issues,tabs are overlapping with each other .please see attached screenshot  

below is my code

<telerik:RadTabStrip ID="RadTabStrip1" Skin="Default" Orientation="HorizontalTop" runat="server" SelectedIndex="0" MultiPageID="RadMultipage1"
            ShowBaseLine="true" >
            <Tabs>
                <telerik:RadTab Text="Advanced Search" Selected="true">
                </telerik:RadTab>
            </Tabs>
            <Tabs>
                <telerik:RadTab Text="Skill Search">
                </telerik:RadTab>
            </Tabs>
        </telerik:RadTabStrip>
Parimal
Top achievements
Rank 1
 asked on 06 Nov 2012
2 answers
106 views
Good morning,
I've a RadComboBox that used as "Multicolumn RadListBox".
http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multicolumncombo/defaultcs.aspx

I would that the list of items is opened when I load the page (as click on right arrow of RadComboBox).
Is possible force this beahavior ?

Thanks,
Godd job
lupotana
Top achievements
Rank 1
 answered on 06 Nov 2012
1 answer
69 views
Hello,

I have a radwindow inside that i have places an aspx page. In that page I have placed a RadSplitter with two radpanes. And in each radpane I have placed an usercontrol. Both of the radpanes contains same usercontrol. So the control hierarchy is somthing like this :

RadWindow -> aspx page -> RadSplitter

Inside radSplitter there are two RadPanes separated by RadSplitBar. And Each RadPane contains an usercontrol inside.

All this stuff works fine in all other browsers except IE 8. Resize of split bar is working fine in IE 8 but expand and collapse is not working.
The two major problm IE 8 is creating is

1) Expand and collapse hides whole radPane
2) Background image of radWindow is not loading.

Please see images attached.

Kindly provide the solution if you have any idea regarding this.

Thanks in advance..




Vessy
Telerik team
 answered on 06 Nov 2012
2 answers
134 views
What I have right now is a RadGrid populated by the NeedDataSource event.  I'm tryin to add a details level.

Do I understand correctly?  If I want to set up a RadGrid with one or more detail levels, each detail level must be separately bound in it's own DetailTableDataBind event?  (The NeedDataSource event can only provide for the top level?)
Boris
Top achievements
Rank 1
 answered on 06 Nov 2012
6 answers
184 views
Hi,

I have tried to implement a load-on-demand scenario as per this demo, but have run into problems. When I first load the page, the first tab is populated properly. If I then click on the 2nd tab and then click back to the first one, the first tab is blank.

Here is my code:
CustomerDetails.aspx
    <script type="text/javascript">
 
        function onTabSelecting(sender, args) {
            if (args.get_tab().get_pageViewID()) {
                args.get_tab().set_postBack(false);
            }
        }
         
    </script>
 
<h1>Customer Details</h1>
 
<div class="normalPanel"><asp:Label ID="CustomerIdLabel" runat="server" Text="Customer ID: " /></div>
 
<telerik:RadTabStrip ID="CustomerDetailsRadTabStrip" ClientIDMode="Static" ShowBaseLine="true"
                     OnClientTabSelecting="onTabSelecting" runat="server" MultiPageID="CustomerDetailsRadMultiPage"
                     OnTabClick="RadTabStrip1_TabClick" Orientation="HorizontalTop">
</telerik:RadTabStrip>
 
<telerik:RadMultiPage ID="CustomerDetailsRadMultiPage" ClientIDMode="Static" runat="server" SelectedIndex="0"
                      OnPageViewCreated="RadMultiPage1_PageViewCreated">
</telerik:RadMultiPage>

CustomerDetails.aspx.cs
using System;
using Microsoft.Practices.ObjectBuilder;
using System.Collections;
using AWModel;
using System.Data.Objects;
using Telerik.Web.UI;
using System.Web.UI;
using AdvWorksWCSF.Shared.Code;
 
namespace AdvWorksWCSF.Customer.Views
{
    public partial class CustomerDetails : Microsoft.Practices.CompositeWeb.Web.UI.Page, ICustomerDetailsView
    {
        private CustomerDetailsPresenter _presenter;
        private ViewStateValue<int> customerID;
 
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                this._presenter.OnViewInitialized();
 
                this.AddTab("Customer Details", "CustomerDetailsControl");
                this.AddPageView(this.CustomerDetailsRadTabStrip.FindTabByValue("CustomerDetailsControl"));
                this.AddTab("Demographics", "DemographicInfoControl");
 
                CustomerDetailsControl customerDetailsControl = this.CustomerDetailsRadMultiPage.FindControl("CustomerDetailsControl_userControl") as CustomerDetailsControl;
                customerDetailsControl.CustomerID = int.Parse(Request.QueryString["CustomerID"]);
                this.CustomerIdLabel.Text += customerDetailsControl.CustomerID.ToString();
            }
            this._presenter.OnViewLoaded();
        }
 
        [CreateNew]
        public CustomerDetailsPresenter Presenter
        {
            get
            {
                return this._presenter;
            }
            set
            {
                if (value == null)
                    throw new ArgumentNullException("value");
 
                this._presenter = value;
                this._presenter.View = this;
            }
        }
 
        private void AddTab(string tabName, string tabValue)
        {
            RadTab tab = new RadTab();
            tab.Text = tabName;
            tab.Value = tabValue;
            this.CustomerDetailsRadTabStrip.Tabs.Add(tab);
        }
 
        protected void RadMultiPage1_PageViewCreated(object sender, RadMultiPageEventArgs e)
        {
            string userControlToLoad = this.AppRelativeTemplateSourceDirectory +
                string.Format(Constants.BuildTabString, e.PageView.ID);
 
            Control userControl = Page.LoadControl(userControlToLoad);
            userControl.ID = string.Format(Constants.BuildUserControlString, e.PageView.ID);
 
            e.PageView.Controls.Add(userControl);
        }
 
        private void AddPageView(RadTab tab)
        {
            RadPageView pageView = new RadPageView();
            pageView.ID = tab.Value;
            this.CustomerDetailsRadMultiPage.PageViews.Add(pageView);
            //pageView.CssClass = "pageView";
            tab.PageViewID = pageView.ID;
        }
 
        protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)
        {
            AddPageView(e.Tab);
            e.Tab.PageView.Selected = true;
        }
    }
}

CustomerDetailsControl.ascx
<%@ Control Language="C#" AutoEventWireup="true" Codebehind="CustomerDetailsControl.ascx.cs" Inherits="AdvWorksWCSF.Customer.Views.CustomerDetailsControl" %>
 
<%@ Import Namespace="AWModel" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
    <asp:FormView ID="CustomerDetailsFormView" runat="server" CssClass="customerDetailsForView">
        <ItemTemplate>
        <asp:Panel ID="NameDetailsPanel" runat="server" ClientIDMode="Static" GroupingText="Name and Title" CssClass="normalPanel">
            <div class="customerDetailsRow">
                <div class="customerDetailsLeftCell">
                    <div class="customerDetailsLabel">Title:</div>
                    <div class="customerDetailsValue"><asp:Label ID="TitleLabel" Text='<%# Eval("Title") %>' runat="server" /></div>
                </div>
                <div class="customerDetailsRightCell">
                    <div class="customerDetailsLabel">Last Name:</div>
                    <div class="customerDetailsValue"><asp:Label ID="LastNameLabel" Text='<%# ((GetDetailsForIndividualCustomerCT)Container.DataItem).LastName.ToString() %>' runat="server" /></div>
                </div>
            </div>
            <div class="customerDetailsRow">
                <div class="customerDetailsLeftCell">
                    <div class="customerDetailsLabel">First Name:</div>
                    <div class="customerDetailsValue"><asp:Label ID="FirstNameLabel" Text='<%# ((GetDetailsForIndividualCustomerCT)Container.DataItem).FirstName.ToString() %>' runat="server" /></div>
                </div>
                <div class="customerDetailsRightCell">
                    <div class="customerDetailsLabel">Middle Name:</div>
                    <div class="customerDetailsValue"><asp:Label ID="MiddleNameLabel" Text='<%# Eval("MiddleName") %>' runat="server" /></div>
                </div>
            </div>
        </asp:Panel>
        <asp:Panel ID="ContactDetailsPanel" GroupingText="Contact Details" runat="server" CssClass="normalPanel">
            <div class="customerDetailsRow">
                <div class="customerDetailsLeftCell">
                    <div class="customerDetailsLabel">Email:</div>
                    <div class="customerDetailsValue"><asp:Label ID="EmailLabel" Text='<%# ((GetDetailsForIndividualCustomerCT)Container.DataItem).EmailAddress.ToString() %>' runat="server" /></div>
                </div>
                <div class="customerDetailsRightCell">
                    <div class="customerDetailsLabel">Phone:</div>
                    <div class="customerDetailsValue"><asp:Label ID="PhoneLabel" Text='<%# Eval("Phone") %>' runat="server" /></div>
                </div>
            </div>
            <div class="customerDetailsRow">
                <div class="customerDetailsLeftCell">
                    <div class="customerDetailsLabel">Address:</div>
                    <div class="customerDetailsValue"><asp:Label ID="AddressLine1Label" Text='<%# ((GetDetailsForIndividualCustomerCT)Container.DataItem).AddressLine1.ToString() %>' runat="server" /></div>
                </div>
                <div class="customerDetailsLeftCell">
                    <div class="customerDetailsLabel"></div>
                    <div class="customerDetailsValue"><asp:Label ID="AddressLine2Label" Text='<%# Eval("AddressLine2") %>' runat="server" /></div>
                </div>
            </div>
            <div class="customerDetailsRow">
                <div class="customerDetailsLeftCell">
                    <div class="customerDetailsLabel">City:</div>
                    <div class="customerDetailsValue"><asp:Label ID="CityLabel" Text='<%# ((GetDetailsForIndividualCustomerCT)Container.DataItem).City.ToString() %>' runat="server" /></div>
                </div>
                <div class="customerDetailsRightCell">
                    <div class="customerDetailsLabel">Post code:</div>
                    <div class="customerDetailsValue"><asp:Label ID="PostalCodeLabel" Text='<%# Eval("PostalCode") %>' runat="server" /></div>
                </div>
            </div>
            <div class="customerDetailsRow">
                <div class="customerDetailsLeftCell">
                    <div class="customerDetailsLabel">State/Province:</div>
                    <div class="customerDetailsValue"><asp:Label ID="Label1" Text='<%# ((GetDetailsForIndividualCustomerCT)Container.DataItem).State_Province.ToString() %>' runat="server" /></div>
                </div>
                <div class="customerDetailsRightCell">
                    <div class="customerDetailsLabel">Sales Territory:</div>
                    <div class="customerDetailsValue"><asp:Label ID="Label2" Text='<%# ((GetDetailsForIndividualCustomerCT)Container.DataItem).Sales_Territory.ToString() %>' runat="server" /></div>
                </div>
            </div>
        </asp:Panel>
        </ItemTemplate>
    </asp:FormView>

CustomerDetailsControl.ascx.cs:
using System;
using Microsoft.Practices.ObjectBuilder;
using AWModel;
using System.Data.Objects;
 
namespace AdvWorksWCSF.Customer.Views
{
    public partial class CustomerDetailsControl : Microsoft.Practices.CompositeWeb.Web.UI.UserControl, ICustomerDetailsControlView
    {
        private CustomerDetailsControlPresenter _presenter;
        private int customerID;
 
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                this._presenter.OnViewInitialized();
            }
            this._presenter.OnViewLoaded();
        }
 
        [CreateNew]
        public CustomerDetailsControlPresenter Presenter
        {
            get
            {
                return this._presenter;
            }
            set
            {
                if (value == null)
                    throw new ArgumentNullException("value");
 
                this._presenter = value;
                this._presenter.View = this;
            }
        }
 
        public int CustomerID
        {
            get
            {
                return customerID;
            }
            set
            {
                customerID = value;
            }
        }
 
        public ObjectResult<GetDetailsForIndividualCustomerCT> CustomerDetailsFormDataSource
        {
            set
            {
                this.CustomerDetailsFormView.DataSource = value;
                this.CustomerDetailsFormView.DataBind();
            }
        }
    }
}

There's another interesting thing which happens. If I add a RadAjaxManagerProxy to the aspx page setting the tabstrip as the source and updated controls along with the Multipage as a second updated control (as is done in the demo referred to above, a javascript error (null reference) is thrown.

<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="CustomerDetailsRadTabStrip">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="CustomerDetailsRadTabStrip" />
                <telerik:AjaxUpdatedControl ControlID="CustomerDetailsRadMultiPage" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="CustomerDetailsRadMultiPage">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="CustomerDetailsRadMultiPage" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>

Here is a screenshot of the error.

Can anyone see why there is a problem? What have I done wrong?

Cheers
Kwok (Andrew)
Top achievements
Rank 1
 answered on 06 Nov 2012
1 answer
303 views
hi there,
i have read many blog posts and have tried several different things and am stuck.

I have a Radwindow which contains a YouTube video. When I close the window, the audio continues to play.

I read all the blog posts (http://blogs.telerik.com/blogs/posts/09-06-04/common-radwindow-issues-and-their-solution.aspx) and attempted to perform the same methodology.

Here is my code on the aspx page:

<telerik:RadWindow ID="rwOrgDetails" runat="server" Modal="true"
       Behaviors="Close,Move"
        ShowContentDuringLoad="False" AutoSize="true"
        AutoSizeBehaviors="Default" MinWidth="400px" Animation="FlyIn"
        KeepInScreenBounds="True" VisibleStatusbar="False"
        OnClientShow="re" DestroyOnClose="true" OnClientClose="OnClientClose" EnableViewState="False">
     <ContentTemplate>
        <asb:organization ID="detailedView" runat="server" />
        <div align="center" class="hiddenClose" style="display:none" >
          <telerik:RadButton ID="RadButton6" SkinID="Close" runat="server" OnClientClicking="cw">
            </telerik:RadButton>      
        </div>
     </ContentTemplate>  
    </telerik:RadWindow>

Within the same page I have the following script:

<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
<script type="text/javascript">
 
    function OnClientClose(oWnd) {
        oWnd.setUrl("about:blank"); // Sets url to blank
} 
  
   </script>
  </telerik:RadScriptBlock>

The function is being accessed, as I have put some alert("test") code in there to make sure but the video continues to play and I dont know if about:blank is being set correctly.

Any help is much appreciated.
Marin Bratanov
Telerik team
 answered on 06 Nov 2012
1 answer
163 views

Hi,

I have filtering enabled in my RadGrid.The filter row is visible, but don't want the filter icons in each table cell. Please provide a method to hide all filter buttons.

Thanks,

Shinu
Top achievements
Rank 2
 answered on 06 Nov 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?