Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
86 views
Hi,
    I have set the Background Color for particular cell on some condition. when i select that row the color of rowselection and cell get getting displayed properly.Please find the attach image for the same.
Pavlina
Telerik team
 answered on 06 Nov 2012
3 answers
724 views
I have managed to display my data in a grid and enabled paging. Is it possible to have paging displayed even if there are not enough rows to show a second or more pages. how do I select different paging options (templates)

Thanks
Pavlina
Telerik team
 answered on 06 Nov 2012
2 answers
286 views
Hi All,
After about three hours of trying I have finally given up and had to use ASP:Textbox but this is not ideal, so hoping someone can tell me what I have done wrong, I have an aspx page linked to a radGrid, when the user clicks edit it opens up a radwindow where they can change the data, I know all the code is working as I can set values from behind but not with user input, Here is the ASPX...
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="SeriesUpdate.aspx.vb" Inherits="SeriesUpdate" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server" id="Head1">
    <title>Update Series</title>
</head>
<body onkeydown="return noBackspace(event)" onload="InitWindow()">
    <form id="Itemedit" runat="server">
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server">
    </telerik:RadStyleSheetManager>
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server">
    </telerik:RadSkinManager>
    <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="All" />
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadInputManager ID="RadInputManager1" runat="server">
    </telerik:RadInputManager>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript" src="scripts\editwindow.js">
        </script>
        <script type="text/javascript">
            function OnClientClicked(button, args) {
                if (window.confirm("Are you sure you want to delete this item?")) {
                    button.set_autoPostBack(true);
                }
                else {
                    button.set_autoPostBack(false);
                }
            }
            function returnArg() {
                var oWnd = GetRadWindow();
                var UniqueID = document.getElementById("<%= lblUniqueID.ClientID %>").value;
                oWnd.close(UniqueID);
            }
        </script>
    </telerik:RadCodeBlock>
    <div>
        <table>
            <tr>
                <td>
                    Reference:
                </td>
                <td>
                    <ASP:Textbox ID="txtSeriesCode" runat="server" Width="150px" MaxLength="10"
                        ToolTip="Maximum 10 character reference">
                    </ASP:Textbox>
                    <Telerik:RadTextbox ID="TextBox1" runat="server"></Telerik:RadTextbox>
                </td>
                <td>
                    <asp:Label ID="lblUniqueID" runat="server" Text="" Visible="false"></asp:Label>
                    <asp:Label ID="InjectScript" runat="server" Text=""></asp:Label>
                </td>
                <td>
                    <asp:CheckBox ID="chkArchived" runat="server" Text="Archivd" TabIndex="99" />
                </td>
            </tr>
            <tr>
                <td>
                    Name:
                </td>
                <td>
                    <Telerik:RadTextbox ID="txtName1" runat="server" Width="532px" Text="">
                    </Telerik:RadTextbox>
                </td>
            </tr>
        </table>
    </div>
    <div class="Radbutton-line">
        <telerik:RadButton ID="btnSave" runat="server" Text="Save & Close">
        </telerik:RadButton>
        <telerik:RadButton ID="btnCancel" runat="server" Text="Cancel">
        </telerik:RadButton>
        <telerik:RadButton ID="btnDelete" runat="server" Text="Delete" OnClientClicked="return OnClientClicked()">
        </telerik:RadButton>
    </div>
    </form>
</body>
</html>
 
and this is my code behind...
Imports Telerik.Web.UI
Imports TimeManager
Imports RoadsInterface
Partial Class SeriesUpdate
    Inherits System.Web.UI.Page
 
    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack And Not Page.IsCallback Then
            Dim intUniqueID As Integer = Request.QueryString("UniqueID")
            lblUniqueID.Text = intUniqueID
            Dim strStaff As String = Session("Staff")
            If String.IsNullOrEmpty(strStaff) Then
                Response.Redirect("~/default.aspx")
            End If
            Dim skn As New Skins
            skn.setSkin(RadSkinManager1)
            'skn.setForm(RadFormDecorator1)
            Dim itm As New dbItem(Session("ConnectionString"))
            itm.InitialiseItem(itm)
            If intUniqueID <> 0 Then
                ShowItem(itm)
            End If
        End If
    End Sub
 
    Public Sub ShowItem(ByRef itm As dbItem)
        itm.SingleSeries(lblUniqueID.Text, itm)
        txtName1.Text = itm.Name
        txtSeriesCode.Text = itm.Number
        chkArchived.Checked = itm.Archive
    End Sub
 
    Protected Sub btnDelete_Click(sender As Object, e As System.EventArgs) Handles btnDelete.Click
        Dim itm As New dbItem(Session("ConnectionString"))
        itm.DeleteSeries(lblUniqueID.Text)
        InjectScript.Text = "<script type='text/javascript'>CloseAndRebind();</" + "script>"
    End Sub
 
    Protected Sub btnCancel_Click(sender As Object, e As System.EventArgs) Handles btnCancel.Click
        InjectScript.Text = "<script type='text/javascript'>CloseAndRebind();</" + "script>"
    End Sub
 
    Protected Sub btnSave_Click(sender As Object, e As System.EventArgs) Handles btnSave.Click
        'txtName1.Text = "Hello"
        MsgBox(txtName1.Text)
        Dim itm As New dbItem(Session("ConnectionString"))
        itm.InitialiseItem(itm)
        itm.UniqueID = lblUniqueID.Text
        itm.Name = txtName1.Text
        itm.Number = txtSeriesCode.Text
        itm.Archive = chkArchived.Checked
        Dim Test As String
        Test = TextBox1.Text
        If lblUniqueID.Text <> 0 Then
            'Update
            itm.UpdateSeries(itm)
        Else
            'Insert
            itm.AddSeries(itm)
        End If
 
        InjectScript.Text = "<script type='text/javascript'>CloseAndRebind();</" + "script>"
    End Sub
 
    Protected Sub chkArchived_CheckedChanged(sender As Object, e As System.EventArgs) Handles chkArchived.CheckedChanged
 
    End Sub
 
    Protected Sub txtName1_TextChanged(sender As Object, e As System.EventArgs) Handles txtName1.TextChanged
        MsgBox(txtName1.Text)
    End Sub
End Class

To Clarify...
My RadTextboxes are not returning the user input to the code behind, but I can set them from code behind, I am not sure what is wrong because the code is copied from a working page
Many Thanks
Ryan
Ryan
Top achievements
Rank 1
 answered on 06 Nov 2012
3 answers
144 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
84 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
183 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
115 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
96 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
56 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
117 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?