Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
103 views
Hello,

I have a RadListView control which displays RadToolTip by coming over an image. Unfortunatily, the radtooltip is not displayed (It was before) for unknown reason - I recieve an error message (Please view the attached image).. Please view the web page: http://tmonavot.com/Pages/GiftGallery.aspx

Here is my code:
<%@ Master Language="C#" MasterPageFile="~/Common/MasterPages/DefaultMasterPage.master" AutoEventWireup="true" CodeFile="DfosMasterPage.master.cs" Inherits="Pages_MasterPages_DfosMasterPage" %>
<%@ Register Src="~/Pages/UserControls/ProductDetails.ascx" TagName="ProductDetails" TagPrefix="uc1" %>
<%@ Register Src="~/Pages/UserControls/ItemsPagesConentWebUserControl.ascx" TagName="ItemsPagesConentWebUserControl" TagPrefix="uc2" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
  
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .RadListView .rlvFloated div.rlvA, 
        .RadListView .rlvFloated div.rlvI
        {
            float: right;
        }
          
        div.RadMenu .rmItem .rmLink .rmLeftImage, 
        div.RadMenu .rmItem .rmLink, 
        div.RadMenu .rmLink .rmText 
        
            margin: 0; 
            padding: 1px; 
             
        
    </style>
</asp:Content>
  
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:Panel ID="Panel1" style="margin-top:15px;" runat="server" >
 <table border="0" cellpadding="0" cellspacing="0" width="100%">
   <tr>
     <td colspan="2">
        <asp:Panel ID="HeaderLabelPanel" runat="server" style="margin-right:5px;">
            <asp:Label ID="HeaderLabel" runat="server" SkinID="HeaderText" Text=""></asp:Label>
        </asp:Panel>
     </td>
   </tr>
   <tr>
     <td valign="top" style="width:210px;">
       <br />
       <telerik:RadAjaxPanel ID="DfosMenuPanelRadAjaxPanel" runat="server">
           <asp:Panel ID="DfosMenuPanel" runat="server" style="margin-right:1px;">
                <telerik:RadMenu ID="RadMenu1" runat="server" Flow="Vertical" Skin=""  EnableImagePreloading="true" >
                </telerik:RadMenu>
           </asp:Panel>
       </telerik:RadAjaxPanel>
     </td>
     <td valign="top" style="width:742px;">
       <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
          
       </asp:ContentPlaceHolder>
  
       <asp:Panel ID="HeaderMenuPagesPanel" runat="server" style="margin-top:20px; margin-left:10px; margin-right:10px;">
               
             <telerik:RadAjaxPanel ID="RingsRadAjaxPanel" runat="server">
                <script type="text/javascript">
  
                    function CloseActiveToolTip() {
                        setTimeout(function () {
                            var tooltip = Telerik.Web.UI.RadToolTip.getCurrent();
                            if (tooltip) tooltip.hide();
                        }, 1000);
  
                    }
  
                </script>
      
                <telerik:RadWindowManager ID="RadWindowManager1" runat="server">   
                    <Windows>   
                        <telerik:RadWindow runat="server" Width="420px" Height="420px" VisibleStatusbar="false" style="z-index:10000;"
                            ID="ExplorerWindow" Modal="true" Behaviors="Default">
                        </telerik:RadWindow>
                    </Windows>   
                </telerik:RadWindowManager
           
                 <telerik:RadToolTipManager runat="server" ID="RadToolTipManager1" Sticky="true" Position="Center"
                                    Width="400px" Animation="FlyIn" HideEvent="LeaveToolTip" GroupPlaceholderID="GroupsEmployeesContainer"
                                    Skin="DisplayItems" EnableEmbeddedSkins="false" OnAjaxUpdate="OnAjaxUpdate"></telerik:RadToolTipManager>
               
                 <asp:Panel ID="ItmPanel" Width="100%" style="margin-right:10px;" runat="server">
                    <uc2:ItemsPagesConentWebUserControl ID="ItemsPagesConentWebUserControl1" runat="server" />
                 </asp:Panel>
                 <br />
               
                 <asp:Panel ID="RadListView1Panel" style="margin-right:10px;" HorizontalAlign="Center" runat="server">
                      
                     <telerik:RadListView runat="server" ID="RadListView1" AllowPaging="True" EnableEmbeddedSkins="false" Width="615px"
                        DataKeyNames="ItemID" DataSourceID="ObjItems" OnPageIndexChanged="RadListView1_PageIndexChanged" onitemdatabound="RadListView1_ItemDataBound">
                        <ItemTemplate>
                            <div class="rlvI" style="margin-left:1px; border:0; border-color:transparent; height:225px; width:315px;">
                                <center>
                                    <asp:Panel ID="ItmPanel" Width="300px" BackImageUrl="~/Common/Img/BackGrounds/g4.gif" style="margin-right:10px;" Height="210px" runat="server">
                                            <asp:Table ID="Table1" Width="300px" HorizontalAlign="Center" BorderColor="Black" BorderWidth="0" runat="server">
                                                <asp:TableRow ID="TableRow2" Height="20px" runat="server">
                                                  <asp:TableCell ColumnSpan="2">
                                                       
                                                  </asp:TableCell>
                                                </asp:TableRow>
                                                <asp:TableRow ID="TableRow1" Height="190px" runat="server">
                                                    <asp:TableCell VerticalAlign="Top" HorizontalAlign="Right" ID="TableCell1" Width="200px" runat="server">
                                                      <div style="margin-right:5px;">
                                                        <asp:Label ID="ItemIDLabel" Visible="false" runat="server" Text='<%# Eval("ItemID") %>'></asp:Label>
                                                        <asp:Label ID="ItmNameLabel" SkinID="ItemHeaderText" runat="server" Text='<%# Eval("ItmName") %>'></asp:Label><br /><br />
                                                        <asp:Label ID="ItmDescLabel" runat="server" Text='<%# Eval("ItmDesc") %>'></asp:Label>
                                                        <asp:Label ID="PriceLabel" runat="server" Visible='<%# (Convert.ToBoolean(Eval("ViewPrice"))) ? true : false %>' Text='<%# "<br/><br/>" + Resources.Resource.PagesItemsPriceLabelText.ToString() + ": " %>'></asp:Label>
                                                    <asp:Label ID="Label1" runat="server" Visible='<%# (Convert.ToBoolean(Eval("ViewPrice"))) ? true : false %>' Text='<%# Eval("ItemPrice").ToString() + " " + Resources.Resource.PagesItemsNewIsraeliShekelText.ToString() %>' ></asp:Label>
                                                      </div>
                                                    </asp:TableCell>
                                                    <asp:TableCell ID="TableCell5" VerticalAlign="Top" Width="100px" runat="server">
                                                        <asp:Image ID="ItmImage" Width='<%# getSrcImgDim(90, Eval("FileUrl").ToString(),"width") %>' Height='<%# getSrcImgDim(90, Eval("FileUrl").ToString(),"height") %>' ImageUrl='<%# (Eval("FileUrl").ToString().Equals(string.Empty)) ? "~/Pages/Design/Imgs/Itms/NoItem.jpg" : (string.Format("~/Pages/Design/WriteOnImage/CreateBImg.aspx?fileUrl={0}&typ=small", Eval("FileUrl").ToString().Replace("~/","").Replace("/","-"))) %>' runat="server" />
                                                        <br /><br /><br />
                                                        <asp:LinkButton ID="MoreDetailsLinkButton" Font-Underline="false" Visible='<%# (Convert.ToBoolean(Eval("ViewItmBigDesc"))) ? true : false %>' ForeColor="Black" Font-Bold="true" Text="<%$ Resources:Resource, PagesItemsMoreDetailsLinkButtonText %>" OnClick="MoreDetailsLinkButton_Click" runat="server"></asp:LinkButton>
                                                    </asp:TableCell>
                                                </asp:TableRow>
                                            </asp:Table>
                             
                                    </asp:Panel>
                                </center>
                            </div>
                        </ItemTemplate>
                        <EmptyDataTemplate>
                            <div class="RadListView RadListView_<%# Container.Skin %>">
                                <div class="rlvEmpty">
                                    <asp:Label ID="NoItemsFoundLabel" runat="server" Text="<%$ Resources:Resource, PagesItemsNoItemsFoundLabelText %>"></asp:Label>
                                </div>
                            </div>
                        </EmptyDataTemplate>
                        <LayoutTemplate>
                            <div class="RadListView RadListViewFloated RadListView_<%# Container.Skin %>" style="background-color:transparent;">
                                <div class="rlvFloated rlvAutoScroll">
                                    <div id="itemPlaceholder" runat="server">
                                    </div>
                                </div>
                                <table cellpadding="0" cellspacing="0" width="100%" style="clear: both;">
                                    <tr>
                                        <td align="center">
                                            <telerik:RadDataPager ID="RadDataPager2" runat="server" Width="280px" PagedControlID="RadListView1"
                                                PageSize="30" >
                                                <Fields >
                                                    <telerik:RadDataPagerButtonField FieldType="FirstPrev" />
                                                    <telerik:RadDataPagerGoToPageField CurrentPageText="Page: " TotalPageText="of" SubmitButtonText="Go"
                                                            TextBoxWidth="15" />
                                                    <telerik:RadDataPagerButtonField FieldType="NextLast" />
                                                </Fields>
                                            </telerik:RadDataPager>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </LayoutTemplate>
                    </telerik:RadListView>
                   
                </asp:Panel>
                <asp:Label ID="MainCtgryLabel" Visible="false" runat="server" ></asp:Label>
                <asp:Label ID="SubCtgryLabel" Visible="false" runat="server" ></asp:Label>
    
                <asp:ObjectDataSource ID="ObjItems" runat="server" 
                    SelectMethod="GetItms" TypeName="CtgrsDataLstObjctGetData">
                    <SelectParameters>
                            <asp:ControlParameter ControlID="MainCtgryLabel" PropertyName="Text" Name="mainCtgry" Type="String" />
                            <asp:ControlParameter ControlID="SubCtgryLabel" PropertyName="Text" Name="subCtgry" Type="String" />
                    </SelectParameters
                </asp:ObjectDataSource>
  
         
          
            </telerik:RadAjaxPanel>
   
        </asp:Panel>
     </td>
   </tr>
 </table>
</asp:Panel>
</asp:Content>

and:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
  
public partial class Pages_MasterPages_DfosMasterPage : System.Web.UI.MasterPage
{
    #region Public Properties
  
    private string _headerLabelString;
    public string HeaderLabelString
    {
        get { return _headerLabelString; }
        set { _headerLabelString = value; }
    }
  
    private string _mainCtgryLabelString;
    public string MainCtgryLabelString
    {
        get { return _mainCtgryLabelString; }
        set { _mainCtgryLabelString = value; }
    }
  
    private string _subCtgryLabelString;
    public string SubCtgryLabelString
    {
        get { return _subCtgryLabelString; }
        set { _subCtgryLabelString = value; }
    }
  
    #endregion Public Properties
  
    #region Page Events
    #endregion Page Events
  
    #region Virtual Methods
    #endregion Virtual Methods
  
    private string browserName = string.Empty;
    private string browserVersion = string.Empty;
    private string theBrowser = string.Empty;
  
    protected void Page_Load(object sender, EventArgs e)
    {
        HeaderLabel.Text = HeaderLabelString;
  
        HeaderLabel.Text = HeaderLabelString;
        MainCtgryLabel.Text = MainCtgryLabelString;
        SubCtgryLabel.Text = SubCtgryLabelString;
  
        browserName = Request.Browser.Browser.ToString();
        browserVersion = Request.Browser.Version.ToString();
        theBrowser = browserName + " " + browserVersion;
  
        if (!Page.IsPostBack)
        {
            RadMenu1.LoadContentFile("~/Common/xml/DfosMenu.xml");
        }
    }
  
    protected void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args)
    {
        this.UpdateToolTip(args.Value, args.UpdatePanel);
  
    }
  
    private void UpdateToolTip(string elementID, UpdatePanel panel)
    {
        Control ctrl = Page.LoadControl("~/Pages/UserControls/ProductDetails.ascx");
        panel.ContentTemplateContainer.Controls.Add(ctrl);
        ProductDetails details = (ProductDetails)ctrl;
  
        details.ItemID = elementID;
    }
  
    protected void RadListView1_ItemDataBound(object sender, RadListViewItemEventArgs e)
    {
  
        if (e.Item.ItemType == RadListViewItemType.DataItem || e.Item.ItemType == RadListViewItemType.AlternatingItem)
        {
            Control target = e.Item.FindControl("ItmImage");
            if (!Object.Equals(target, null))
            {
                if (!Object.Equals(this.RadToolTipManager1, null))
                {
                    // add to tooltip manager  
                    string keyValue = (e.Item as RadListViewDataItem).GetDataKeyValue("ItemID").ToString();
                    this.RadToolTipManager1.TargetControls.Add(target.ClientID, keyValue, true);
                }
            }
        }
    }
  
    protected void RadListView1_PageIndexChanged(object sender, RadListViewPageChangedEventArgs e)
    {
        if (e.CommandName == "Sort" || e.CommandName == "Page")
        {
            RadToolTipManager1.TargetControls.Clear();
        }
  
        RadListView1.CurrentPageIndex = e.NewPageIndex;
        RadListView1.DataBind();
    }
  
    protected void MoreDetailsLinkButton_Click(object sender, EventArgs e)
    {
        LinkButton _moreDetailsLinkButton = (LinkButton)sender;
        Session["itemId"] = null;
        Session["itemId"] = (_moreDetailsLinkButton.FindControl("ItemIDLabel") as Label).Text.ToString();
        Response.Redirect("~/Pages/MoreDetails/Dfos/Default.aspx");
    }
  
    public int getSrcImgDim(int maxDim, string _srcImgUrl, string dimType)
    {
        int[] _dim = new int[2];
        int tempwidth = 0;
        int tempHeight = 0;
        System.Drawing.Image img = System.Drawing.Image.FromFile(Server.MapPath(_srcImgUrl));
  
        _dim[0] = Convert.ToInt32(img.Size.Width);
        _dim[1] = Convert.ToInt32(img.Size.Height);
  
        if (_dim[0] > _dim[1])
        {
            tempwidth = maxDim;
            float wrltn = ((float)_dim[0] / (float)maxDim);
            tempHeight = (int)((float)_dim[1] / (float)wrltn);
        }
        else
        {
            tempHeight = maxDim;
            float wrltn = ((float)_dim[1] / (float)maxDim);
            tempwidth = (int)((float)_dim[0] / (float)wrltn);
        }
  
        if (dimType.Equals("width"))
        {
            return tempwidth;
        }
        else
        {
            return tempHeight;
        }
    }
  
    protected void RadListView1_ItemCreated(object sender, RadListViewItemEventArgs e)
    {
        /*if (e.Item is RadListViewDataItem)
        {
            Panel _generalItemsPanel = e.Item.FindControl("GeneralItemsPanel") as Panel;
            Panel _itemsPanel = e.Item.FindControl("ItemsPanel") as Panel;
  
            switch (theBrowser)
            {
                case "Safari 4.0":
                case "Safari 5.0": { _generalItemsPanel.Style.Add("margin-left", "23px"); break; }
                case "Firefox 3.0":
                case "Firefox 3.5":
                case "Firefox 3.6": { _generalItemsPanel.Style.Add("margin-left", "-16px"); break; }
                case "IE 6.0": { _generalItemsPanel.Style.Add("margin-left", "-3px"); break; }
                case "IE 7.0": { _generalItemsPanel.Style.Add("margin-left", "-3px"); break; }
                case "IE 8.0": { _generalItemsPanel.Style.Add("margin-left", "-3px"); break; }
                case "Opera 9.80":
                case "Opera 10.00": { _generalItemsPanel.Style.Add("margin-left", "15px"); break; }
                case "Chrome 5.0":
                case "Chrome 6.0": { _generalItemsPanel.Style.Add("margin-left", "15px"); break; }
                default: { _generalItemsPanel.Style.Add("margin-left", "15px"); break; }
            }
        }*/
    }
}

Plaese, I need to know why is this error is displayed and why the RadTooTip is not displayed.
It is appreciated to send me the moified code.

Regards,
Bader
Svetlina Anati
Telerik team
 answered on 03 Mar 2011
3 answers
77 views
When the parent doucment is served by HTTP and the RadWindow is accessing a resource over HTTP, the GetRadWindow() function below works fine.

When the parent doucment is served by HTTPS and the RadWindow is accessing a resource over HTTPS, the GetRadWindow() function below works fine.

When the parent doucment is served by HTTP and the RadWindow is accessing a resource over HTTPS, the GetRadWindow() function below fails when called within the window (to close itself) with Permission denied.  All the JS needed is served to the window over HTTPS.  All I'm trying to do is close the RadWindow.

Does anyone know of a work around that would allow an HTTPS window that was opened from an HTTP parent close itself?

function GetRadWindow()  
{
    var oWindow = null;  
    if (window.radWindow)
        oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog  
    else if (window.frameElement.radWindow)
        oWindow = window.frameElement.radWindow;//IE (and Moz az well)  
    return oWindow;  
}

Thanks,
Kevin
Svetlina Anati
Telerik team
 answered on 03 Mar 2011
1 answer
67 views
 view file
Kate
Telerik team
 answered on 03 Mar 2011
1 answer
66 views
I have seen the User Control and other demos and forum postings about adding Spell to a repeater.

Is it possible to call Spell and have it return a boolean result as to whether one or more errors exists in the control or not, without opening the Spell Check window.

I am hoping to use Spell server-side to parse the results within a SQL repeater and return a list of the fields that need correcting.

In other words, I want to spell check 20 fields, and then build a page which allows the end-user to use spell to correct the issues -- but only display the records/controls that have one or more error in it.

Is this possible with Spell?
Rumen
Telerik team
 answered on 03 Mar 2011
4 answers
263 views
Hi,

We're using Telerik RadEditor for MOSS version 5.7.3.0. We use the editor with IE8.

When we add indent in a paragraph, the editor wraps the P tag in a blockquote tag. We don't want this behaviour because we use blockquotes tags for other purpose (i.e. quoted text).

For example, it would be better to simply add a padding-left to the p tag. Is it possible?

Thanks in advance.

Xavier Stévenne.
Neil
Top achievements
Rank 1
 answered on 03 Mar 2011
1 answer
124 views
Hi

I have had to set the I have had to set the ImageStorageLocation attribute to session to allow the captcha image to be displayed when we deploy our application to the server.

Following on from this i had to change the following in the web.config and i would like to know if there are any known impacts to other telerik controls if changing this.

Changed From:
<add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />

Changed To:
<add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResourceSession" verb="*" validate="false" />

Kind Regards,
Jonathan
Pero
Telerik team
 answered on 03 Mar 2011
1 answer
184 views
I am doing an evaluation for our company's 3rd party tool set which is currently Intersoft. One of the biggest features that we use is their BatchUpdate which basically opens allows editing of every column within the Grid. Then, we use a button postback and the Grid has a collection of edited rows that we can use to update only the dirty row's data.

A few questions:

1) I noticed that batch update is possible if the "EditColumn" is hidden. However, the updated data can be lost if: 1) Sort/Filter/Page causing a postback 2) Edit button is clicked changing the row to Edit mode (This can be fixed if the entire grid is loaded in edit mode but #1 issue still exists)

2) Is there a way to tell which Grid.EditedItems are dirty? I noticed this thread (http://www.telerik.com/community/forums/aspnet-ajax/grid/radgrid-multi-row-questions.aspx) which checks if a row is dirty but it's an iterative process of checking every single row's field before/after update? What about for items to be deleted/inserts? Can all of that be done on the client-side and then handled with one single update? Performing multiple ajax call backs is a performance concern for us.

3) Is there a way to implement #1 with using all of the edit modes: inline, form, and user control? Avoid postbacks until a single batch update?

4) Is there a way to bind the grid using client-side web services using WCF? I noticed a few examples using .NET 2.0 Web Services (ASMX)?

5) Is there a way to implement Google-Like searches in the DropDownList within the Grid's columns?

Thank you for the help.
Tsvetina
Telerik team
 answered on 03 Mar 2011
1 answer
87 views
Hi,
    i am working on radbutton control but we have only standard button..and standard button is not being displayed properly. could u plz help me..and how to get other buttons in my project...ex:imagebutton,togglebutton....
Pero
Telerik team
 answered on 03 Mar 2011
1 answer
179 views
Hi
We have use Radbutton inside asp panel but when we try to set the property/Method set_AutoPostBack(false) . It is giving JavaScript Error in IE 6.0 as show in attachment but in IE 8.0 it work fine . kindly help us how we can resolve this issue we have goLive very soon
Pero
Telerik team
 answered on 03 Mar 2011
1 answer
124 views
Hi
I have a radgrid and i am trying to use treeview under radgrid.
Similar to your demo example http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridwithtreeviewcomboboxeditors/defaultcs.aspx?product=grid

But I cant get it to work.
I want a empty grid in which onClick of 'Add New Record' I want toinsert into tblPettyCash.
I have a table tblExpCodes with fields

ExpType
Category
ExpCodeDesc only to display data.

I want to have tree view for these fields and only select them NOT to update anything on tblExpCodes table.
I use tblPettyCash to enter Claims.
The demo is slightly complicated 
I created a similar .aspx page but giving me error saying

These columns don't currently have unique values.


I have attached the code files.
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/CWCStaffnet.Master" CodeBehind="Petty.aspx.cs" Inherits="CWC.Staffnet.Forms.Finance.Petty" %>
  
<%@ MasterType VirtualPath="~/CWCStaffnet.Master" %>
  
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="../Styles/Styles.css" rel="stylesheet" type="text/css" /> 
    <script type="text/javascript"  src="../JSValidation.js"></script>       
    <style type="text/css">
        .MyImageButton
        {
           cursor: hand;
        }
        .EditFormHeader td
        {
            font-size: 14px;
            padding: 4px !important;
            color: #0066cc;
        }
        </style>
  
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h1>Petty Cash Claim Form</h1>
      
    <asp:Panel ID="plForm" runat="server">
     <telerik:RadAjaxLoadingPanel ID="LoadingPanel1" runat="server" IsSticky="True" Style="position: absolute;  top: 0; left: 0; height: 100%; width: 100%;" >
        </telerik:RadAjaxLoadingPanel>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
  
            <script type="text/javascript">
                function RowDblClick(sender, eventArgs) {
                    sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
                }
            </script>
  
        </telerik:RadCodeBlock>
         <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
        <script type="text/javascript">
  
            //stop the event bubbling
            function StopPropagation(e) {
                if (!e) {
                    e = window.event;
                }
  
                e.cancelBubble = true;
            }
  
            //find the selected node in the treeview inside the combobox and scroll it into view
            function OnClientDropDownOpenedHandler(sender, eventArgs) {
                var tree = sender.get_items().getItem(0).findControl("RadTreeView1");
                var selectedNode = tree.get_selectedNode();
  
                if (selectedNode) {
                    selectedNode.scrollIntoView();
                }
            }
            //when tree node is clicked, set the text and value for the item in the combobox and commit the changes 
            function nodeClicking(sender, args) {
  
                //get the id of the employeesCombo in the edited row (passed from the server in the ItemDataBound event handler) 
                var comboBox = $find(window['comboId']);
                var node = args.get_node();
  
                comboBox.set_text(node.get_text());
  
                comboBox.trackChanges();
                comboBox.get_items().getItem(0).set_text(node.get_text());
                comboBox.get_items().getItem(0).set_value(node.get_value());
                comboBox.commitChanges();
  
                comboBox.hideDropDown();
                comboBox.attachDropDown();
            }
              
        </script>
    </telerik:RadScriptBlock>
  
 <asp:Label ID="Label1" runat="server" EnableViewState="false" Font-Bold="true" Text="Orders List" />
    <telerik:RadGrid ID="RadGrid1" AutoGenerateColumns="false" PageSize="15" AllowPaging="true"
        AllowSorting="true" runat="server" DataSourceID="LinqPettyCash" AllowAutomaticUpdates="true"
        AllowAutomaticInserts="True" ShowStatusBar="true" OnItemCreated="RadGrid1_ItemCreated"
        OnUpdateCommand="RadGrid1_UpdateCommand" >
        <MasterTableView DataKeyNames="Id" EditMode="InPlace" CommandItemDisplay="TopAndBottom" DataSourceID="LinqPettyCash"
            TableLayout="Fixed">
            <Columns>
                <telerik:GridBoundColumn UniqueName="Id" DataField="Id" HeaderText="Id"
                    ReadOnly="true" />
                    <telerik:GridTemplateColumn UniqueName="Code" HeaderText="Code" SortExpression="Code"
                    ItemStyle-Width="400px">
                    <ItemTemplate>
                        <%#DataBinder.Eval(Container.DataItem, "ExpenditureCode")%>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <!-- Show employees in the treeview -->
                        <telerik:RadComboBox ID="RadComboBox1" runat="server" Width="180px"
                            ShowToggleImage="True" Style="vertical-align: middle;" OnClientDropDownOpened="OnClientDropDownOpenedHandler"
                            ExpandAnimation-Type="None" CollapseAnimation-Type="None">
                            <ItemTemplate>
                                <div id="div1" onclick="StopPropagation(event);">
                                    <telerik:RadTreeView runat="server" ID="RadTreeView1" OnClientNodeClicking="nodeClicking"
                                        Height="140px" DataTextField="ExpenditureCode" DataValueField="CodeDescription" DataFieldID="CodeDescription"
                                        DataFieldParentID="ExpType" DataSourceID="ExpDataSource" />
                                </div>
                            </ItemTemplate>
                            <Items>
                                <telerik:RadComboBoxItem Text="" />
                            </Items>
                        </telerik:RadComboBox>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                </Columns>
        </MasterTableView>
    </telerik:RadGrid>
     <asp:Label ID="lblMessage" runat="server" EnableViewState="false" Font-Bold="true" />
  
     <br />
                 <p><asp:Label ID="lbError" runat="server" CssClass="message" Visible="false"></asp:Label></p>
                 <asp:ValidationSummary runat="server" ID="validationSummary3" ValidationGroup="Fault" /> 
                   <asp:Button ID="btSubmit" runat="server" CausesValidation="true" 
                       OnClick="btSubmit_Click" Text="Submit" ValidationGroup="Fault" />
  
     <asp:SqlDataSource ID="ExpDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:cwc_staffnetConnectionString %>"
        SelectCommand="SELECT DISTINCT Category,Id,CodeDescription, ExpenditureCode,ExpCodeDesc,ExpType  FROM tblExpenditureCodes" 
         InsertCommand="INSERT INTO tblPettyCashes ([ExpenditureCode], [ExpType],[Id]) VALUES (@ExpenditureCode, @ExpType, @Id)"
  
        />
         <asp:LinqDataSource ID="LinqPettyCash" runat="server" 
            ContextTypeName="CWC.Staffnet.Forms.StaffnetDataContext" 
            TableName="tblPettyCashes" EnableDelete="True" 
            EnableUpdate="True" EnableInsert="true" >
        </asp:LinqDataSource>  
        </asp:Panel>
    <asp:Panel ID="plConfirm" runat="server" Visible="false">
    <table>  
  <tr>
    <td
        <p><b>Notification of Petty example Form.</b></p>
        <p>
            You have successfully completed the Petty cash Claim form. </p>            
        <p>       
            For any questions or comments regarding this form please contact 
            <a href="mailto:online.services@cwc.ac.uk"> Online services </a>
            Thank you.</p>
        </td>         
        </tr>
</table>
    </asp:Panel>
     <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="plfrm">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl LoadingPanelID="LoadingPanel1" ControlID="RadGrid1"/>
                        <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
                        <telerik:AjaxUpdatedControl LoadingPanelID="LoadingPanel1" ControlID="lstName" />
                        <telerik:AjaxUpdatedControl LoadingPanelID="LoadingPanel1" ControlID="lstFaculty" />   
                        <telerik:AjaxUpdatedControl LoadingPanelID="LoadingPanel1" ControlID="lstCentre" />   
                    </UpdatedControls>
                </telerik:AjaxSetting>
                 
            </AjaxSettings>
        </telerik:RadAjaxManager>
</asp:Content>
  
  
******************************************************************************************************************************
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web.UI;
using Telerik.Web.UI;
using config = CWC.Staffnet.Forms.Properties.Settings;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
using System;
  
  
namespace CWC.Staffnet.Forms.Finance
{
    public partial class Petty : System.Web.UI.Page
    {
        private StaffnetDataContext dc;      
        protected void Page_Init(object sender, EventArgs e)
        {
            dc = new StaffnetDataContext();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
  
        }
        protected void btSubmit_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (Page.IsValid)
            {
                try
                {
                    AddRecord();
                    SendEmail();
                    plConfirm.Visible = true;
                    plForm.Visible = false;
                }
                catch (Exception ex)
                {
                    ShowErrorMessage(ex.ToString());
                }
            }
            else
            {
                string msg = string.Empty;
                foreach (IValidator validator in this.Validators)
                {
                    if (!validator.IsValid)
                    {
                        msg += String.Format("{0}<br/>", validator.ErrorMessage);
                        ShowErrorMessage(msg);
                    }
                }
            }
        }
        private void ShowErrorMessage(string ex)
        {
            lbError.Text = ex.ToString();
            lbError.Visible = true;
        }
        private void AddRecord()
        { }
        private void SendEmail()
        { }
        protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
        {
            //if a grid item is in edit mode, wire the ItemsRequested event of the customersCombo to filter the items in it based on the selection in the freight combo
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                RadComboBox freightCombo = (e.Item as GridEditableItem)["Code"].Controls[0] as RadComboBox;
  
                if (Page.IsCallback)
                {
                      
                }
            }
        }
  
        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridEditableItem)
            {              
  
                //set the selected value for the Employees combobox to match the value in the edited cell
                RadComboBox employeesCombo = (e.Item as GridEditableItem).FindControl("RadComboBox1") as RadComboBox;
                employeesCombo.Items[0].Text = DataBinder.Eval(e.Item.DataItem, "ExpenditureCode").ToString();
  
                //set the selection in the treeview inside the combobox to match the value in the edited cell
                RadTreeView employeesTreeView = employeesCombo.Items[0].FindControl("RadTreeView1") as RadTreeView;
                employeesTreeView.FindNodeByText(DataBinder.Eval(e.Item.DataItem, "ExpenditureCode").ToString()).Selected = true;
                //Expand all nodes to scroll the selected into view. Have in mind that load-on-demand is recommended with very large number of nodes in the treeview 
                employeesTreeView.ExpandAllNodes();
  
                //register script block which holds the client id of the employeesComboBox. Will be used to reference the client object of the combobox in the RadTreeView's OnClientNodeClicking event handler
                RadScriptManager.RegisterClientScriptBlock(this.Page, typeof(Page), "employeesComboScript", "<script type='text/javascript'>window['comboId'] = '" + e.Item.FindControl("RadComboBox1").ClientID + "';</script>", false);
  
            }
             
        }
        protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e)
        {
            string empId = (((e.Item as GridEditableItem).FindControl("RadComboBox1") as RadComboBox).Items[0].FindControl("RadTreeView1") as RadTreeView).SelectedNode.Value;
  
            //if the EmployeeID value is empty, cancel the update operation
            if (empId == string.Empty)
            {
                e.Canceled = true;
                SetMessage("Order cannot be updated. You must select an employee from the provided list");
            }
            else
            {
                LinqPettyCash.UpdateParameters["Id"].DefaultValue = empId;
            }
        }
        public void SetMessage(string message)
        {
            lblMessage.Text = message;
        }
  
    }
}

If you could help me quickly.
Thankyou
Suchi



Pavlina
Telerik team
 answered on 03 Mar 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?