Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
97 views
Hello,

I'm encountering a smaal issue: (in fireFox, but I think Chrome too)

In the page_Load I do this:

RadNotification1.ShowInterval = 12000 ' 2 minutes
RadNotification1.AutoCloseDelay = 10000 ' 10 sec
lbl_NotifyText.Text = Format(Now, "HH:mm"' a label within the RadNotification1

So, say I start the page at 11:00, I want to see the notification at 11:02
But during this time I do some PostBacks, until 11:01, what should reset the RadNotification1 to 11:03 and the text in the label to "11:03". Well.. It doesn't...

Although the code is executed (breakpoint) and the new timer values are added and the text was changed, I still get a message at 11:02 with the label text "11:02".

How can I change this behaviour?


Kind regards and thanks in advance,

Erik
   
Erik
Top achievements
Rank 2
 answered on 12 Sep 2012
3 answers
283 views
Hi guys,

I have a RadComboBox as follows
<radcontrol:RadComboBox ID="MessageRecepientsSelectorComboBox" runat="server" EnableLoadOnDemand="true"    
    LoadingMessage="Loading..." EmptyMessage="Please enter recepient(s) for the message..."   
    OnItemsRequested="MessageRecepientsSelectorComboBox_OnItemsRequested" Width="450" ShowDropDownOnTextboxClick="false" 
    Filter="StartsWith" OnSelectedIndexChanged="MessageRecepientsSelectorComboBox_OnSelectedIndexChanged" 
    AutoPostBack="true" EnableItemCaching="true"></radcontrol:RadComboBox> 

Which is inside a Load on demand RadPageView (incase that is relevant).

The ComboBox works fine for getting and matching values (names in this case) however in the SelectedIndexChanged my RadComboBox.SelectedItem is null, RadComboBox.Items.Count = 0. See below

protected void MessageRecepientsSelectorComboBox_OnItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)  
    {  
        RadComboBox recepientSelectorComboBox = (RadComboBox)sender;  
        if (!e.Text.Equals("") && e.Text.Length >= 1)  
        {  
            List<Controls_RecepientsSelectorAJAXDropDownResult> potentialRecepients = MemberContactStaticRepository.GetRecepientsForAJAXSelector(53, e.Text);  
            RadComboBoxItem currentItem = new RadComboBoxItem(); //stop re initialising var in loop  
            for(int i = 0;i < potentialRecepients.Count();i++)  
            {  
                currentItem = new RadComboBoxItem(potentialRecepients[i].UserName, potentialRecepients[i].UserID.ToString());  
                //currentItem.Attributes["ContactType"] = "User";  
                recepientSelectorComboBox.Items.Add(currentItem);  
            }  
        }  
    } 

protected void MessageRecepientsSelectorComboBox_OnSelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)  
    {  
        RadComboBox recepientBox = (RadComboBox)sender;  
        //RadComboBoxItem selectedItem = MessageRecepientsSelectorComboBox.FindItemByValue(e.Value); //finds nothing == null  
        //MessageRecepientsSelectorComboBox.Items.Count; // is 0          
        //MessageRecepientsSelectorComboBox.SelectedIndex;//returns -1       
    } 

Please note in the OnSelectedIndexChanged it is all commented out but the comments beside it tell you what happens.
I need it to have a SelectedItem so that i can access the Attributes i need to set.

Thanks in advance,
Pete
Ivana
Telerik team
 answered on 12 Sep 2012
1 answer
91 views
I would like to have a Radcomobox with load-on-demand turned on, and as the user is typing a search term in the input box of the combobox, instead of showing the results as a plain list, I would like the results to appear in a treeview. I am having a lot of difficulty in doing this.

I have gone through this forum post but it does not apply to my situation because I do not need to subscribe to nodeexpand event or nodeclick event. I need to subscribe to the combobox's itemsrequested event.

If this is too difficult, any suggestion for a similar solution will be appreciated, where as a user is typing a search term in a textbox, the results are being displayed in a treeview, but taking care to not cause a postback on every single key click (by building a small delay like the combobox does).

The error I am getting is: "Script control &#39'rtcICD9&#39; is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors(). Parameter name: scriptControl"

Here is my code:
<telerik:RadComboBox ID="ddlICD9Code" runat="server" Width="400px" MarkFirstMatch="true"
                                    AppendDataBoundItems="true" EnableLoadOnDemand="true" EnableItemCaching="true"
                                    MinFilterLength="3" ItemRequestTimeout="600"
                                    OnItemsRequested="ddlICD9Code_ItemsRequested" >
                                    <ItemTemplate>
                                        <telerik:RadTreeView runat="server" ID="rtvICD9" DataFieldID="Id" DataFieldParentID="ParentId" DataValueField="Id" DataTextField="LongName">
                                            <DataBindings>
                                                <telerik:RadTreeNodeBinding Depth="0" />
                                            </DataBindings>
                                        </telerik:RadTreeView>
                                    </ItemTemplate>
                                    <Items>
                                        <telerik:RadComboBoxItem />
                                    </Items>
                                </telerik:RadComboBox>
 
 
protected void ddlICD9Code_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
    {
        string filterString = e.Text;
 
        if (filterString.Length >= 3)
        {
            var qry = execute database query here;
 
            RadTreeView rtvICD9 = ddlICD9Code.Items[0].FindControl("rtvICD9") as RadTreeView;
            rtvICD9.DataSource = qry;
            rtvICD9.DataBind();
        }      
    }
Ivana
Telerik team
 answered on 12 Sep 2012
1 answer
90 views
I am looping to add Items to a rad tag cloud...

foreach (KeyWord kw in keyWordList)
            {
                RadTagCloudItem item = new RadTagCloudItem();
                item.Text = kw.KeyWordText;
                item.ToolTip = kw.ReturnMessageText;
                item.Value = kw.KeyWordID.ToString();
                RadTagCloud1.Items.Add(item);
            }


I have verified that during the loop the values are being set properly.

I then call a javascript function when an item is clicked:

<telerik:RadTagCloud ID="RadTagCloud1" runat="server" Skin="MetroTouch" OnClientItemClicked="KwDetail">
</telerik:RadTagCloud>



Which is executed here:

function KwDetail(sender, args) {
                var item = args.get_item();
                var toolTip = item.get_toolTip();
                var text = item.get_text();
                var items = sender.get_items();
                var value = item.get_value();
}


and the value is set to null. I would appreciate any help on this matter.


Princy
Top achievements
Rank 2
 answered on 12 Sep 2012
1 answer
88 views
I would like bind a rad chart with multiple serieses with different datasets (dtDev,dtProd, dtQA), Could tell me how to the coding?  
  


Just take blind examples as we have three dates dtDev,dtProd, dtQA.


Please healp, Thank You in Advance!




    monthlyradchartcontrole.Clear()
    Dim dtDev as dataset = nothing
    dtDev = obj.datareturn(parameters)
    
    monthlyradchartcontrole.DataSource = dtDev
        
    monthlyradchartcontrole.DataBind()
        
    monthlyradchartcontrole.Series(0).DataXColumn = "ScheduledStartDate"
    monthlyradchartcontrole.Series(0).DataYColumn = "ChamberUtilization"
        
    monthlyradchartcontrole.PlotArea.XAxis.AxisLabel.TextBlock.Text = monthlyXaxislableName
    monthlyradchartcontrole.PlotArea.XAxis.AxisLabel.Visible = True
                    monthlyradchartcontrole.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.Red
    monthlyradchartcontrole.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.Position.Auto = True
        
    monthlyradchartcontrole.PlotArea.YAxis.AxisLabel.Visible = True
    monthlyradchartcontrole.PlotArea.YAxis.AxisLabel.TextBlock.Text = monthlyYaxislableName
                    monthlyradchartcontrole.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.Red
    monthlyradchartcontrole.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.Position.Auto = True
        
    monthlyradchartcontrole.Legend.Visible = False




Thank You,








Evgenia
Telerik team
 answered on 12 Sep 2012
1 answer
82 views
I have a module that generates PDF files from multiple threads and I need to report the progress
(% of completion by thread). My UI looks like this:

Client Name Created By Total No. of Files Progress 
======================================================================
ABC  Murray 154 Progress Bar Control 1
CBA  Federer 504 Progress Bar Control 2  JKL  Haas 254 Progress Bar Control 3 I have tried to use RadProgressArea controls to implement this. However, I have read that the RadProgressManager handles the entire page as a whole and therefore all the RadProgressArea controls will display the same information.
Is this limitation still valid? Is there any other Telerik controls that can handle my requirement?

Thanks.
Peter Filipov
Telerik team
 answered on 12 Sep 2012
1 answer
115 views
I have a RadComboBox inside Radgrid.
i need load items ondemand, but OnItemrequest does not fire.

The grid is a usercontrol.
This is my code

-ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="FileNameRule.ascx.cs"
    Inherits="WebSearch.UI.Admin.UserControls.Library.FileNameRule" %>
<link href="/UI/Style/Admin/UserControls/FileNameRule.css" rel="stylesheet" type="text/css" />










 
<div class="exampleView">
    <div class="title">
        <asp:Label ID="lblShowAsTitle" runat="server" />
    </div>
    <div class="label">
        <asp:Label ID="lblShowAS" runat="server" />
    </div>
</div>
<div class="clear">
</div>




<div class="exampleView">
  <div class="clear">
</div>
        <telerik:RadGrid runat="server" ID="MyGrid" AutoGenerateColumns="false" Skin="Vista"  
            AllowMultiRowSelection="True" PageSize="10" AllowPaging="true" EnableViewState="false">


            <MasterTableView DataKeyNames="LibraryId,Id" CommandItemDisplay="Top" EditMode="InPlace">
                <Columns>
                
                    <telerik:GridClientSelectColumn CommandName="Select" UniqueName="Select" HeaderStyle-Width="30px"
                        Resizable="false" />
                    <telerik:GridEditCommandColumn HeaderStyle-Width="25px" UniqueName="EditCommandColumn"
                        ButtonType="ImageButton" EditImageUrl="/UI/Images/grid_edit.png" Resizable="false">
                    </telerik:GridEditCommandColumn>
                    <telerik:GridButtonColumn UniqueName="btnDelete" ConfirmDialogType="RadWindow" ButtonType="ImageButton"
                        CommandName="Delete" ConfirmDialogHeight="100px" ConfirmDialogWidth="300px" HeaderStyle-Width="25px"
                        Resizable="false" ImageUrl="/UI/Images/cross.png" />
                    <telerik:GridTemplateColumn DataField="Id" HeaderText="Id" UniqueName="Id" Visible="false"
                        ConvertEmptyStringToNull="true">
                        <InsertItemTemplate>
                            <telerik:RadTextBox ID="lblId" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Id") %> '
                                Width="150px" ReadOnly="true" Enabled="false" CssClass="labelGrid" />
                        </InsertItemTemplate>
                        <EditItemTemplate>
                            <telerik:RadTextBox ID="txtId" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Id") %> '
                                Width="150px" CssClass="labelGrid" ReadOnly="true" />
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn DataField="Position" HeaderText="Position" UniqueName="Position" Visible="false" HeaderStyle-Width="1px" 
                        ConvertEmptyStringToNull="true">
                            <EditItemTemplate>
                            <asp:Label ID="lblPosition" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Position") %> '
                                Width="150px" CssClass="labelGrid" ReadOnly="true" />
                        </EditItemTemplate>
                         <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Position") %>'></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn UniqueName="Type" DataField="TypeId">
                        <EditItemTemplate>
                            <telerik:RadComboBox runat="server" ID="cbType" EnableLoadOnDemand="True" EnableAutomaticLoadOnDemand="true"  DataTextField="CDetailText"
                                DataValueField="CDetailId" HighlightTemplatedItems="true" Width="90%" CausesValidation="false" AutoPostBack="true"  OnSelectedIndexChanged="cbType_SelectedIndexChanged"/>
                            <br />
                            <asp:RequiredFieldValidator ID="frSecurity" runat="server" ErrorMessage="*" CssClass="validator"
                                Display="Dynamic" ControlToValidate="cbType"></asp:RequiredFieldValidator>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblDatatype" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Type") %>'></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                  
                    <telerik:GridTemplateColumn UniqueName="Value" DataField="ValueId">
                        <EditItemTemplate>
                            <telerik:RadComboBox runat="server" ID="cbValue" EnableLoadOnDemand="True" DataTextField="CDetailText"
                                DataValueField="CDetailId" HighlightTemplatedItems="true" Width="90%" CausesValidation="false" />
                           
                           <telerik:RadComboBox runat="server" ID="cbField"  DataTextField="Header"
                                DataValueField="Id" HighlightTemplatedItems="true" Width="90%" CausesValidation="false" ItemsPerRequest="10"
                ShowMoreResultsBox="true" EnableVirtualScrolling="true"  EnableLoadOnDemand="True" />
                           <telerik:RadTextBox runat="server" ID="txtValueInput"></telerik:RadTextBox>
                           <br />
                       <asp:CustomValidator ID="cvValue" runat="server" ErrorMessage="*" CssClass="validator"
                                Display="Dynamic" ControlToValidate="cbValue"  OnServerValidate="cvValue_ServerValidate"></asp:CustomValidator>
                               <asp:CustomValidator ID="cvField" runat="server" ErrorMessage="*" CssClass="validator"
                                Display="Dynamic" ControlToValidate="cbField"  OnServerValidate="cvField_ServerValidate"></asp:CustomValidator>
                                 <asp:CustomValidator ID="cvValueInput" runat="server" ErrorMessage="*" CssClass="validator"
                                Display="Dynamic" ControlToValidate="txtValueInput"  OnServerValidate="cvValueInput_ServerValidate"></asp:CustomValidator>


                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblValue" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ValueName") %>'></asp:Label>
                             <asp:Label ID="lblFieldName" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "FieldName") %>'></asp:Label>
                             <asp:Label ID="lbValueInput" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Value") %>'></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    
                                       
                </Columns>
                <CommandItemTemplate>
                    <div class="quickAdd">
                        <asp:LinkButton ID="lnkqQuitInsert" runat="server" CommandName="InitInsert">
                            <asp:ImageButton ID="imgQuickAdd" runat="server" ImageUrl="/UI/Images/add.png" />
                            <asp:Label ID="lblQuickAdd" runat="server" /></asp:LinkButton>&nbsp;&nbsp;
                        <asp:LinkButton ID="lnkDeleteSelected" CommandName="SelectRow" runat="server" OnClick="DeleteSelectedItems">
                            <asp:ImageButton ID="imgDeleteSelected" runat="server" ImageUrl="/UI/Images/cross.png" />
                            <asp:Label ID="lblDeleteSelected" runat="server" /></asp:LinkButton>&nbsp;&nbsp;
                        <asp:LinkButton ID="lnkDeleteAllValues" runat="server" OnClick="DeleteValues">
                            <asp:ImageButton ID="imgDeleteAllValues" runat="server" ImageUrl="/UI/Images/delete_all.png" />
                            <asp:Label ID="lblDeleteAllValues" runat="server" /></asp:LinkButton>&nbsp;&nbsp;
                    </div>
                </CommandItemTemplate>
            </MasterTableView>
             <ClientSettings AllowRowsDragDrop="True">
                    <Selecting AllowRowSelect="True" EnableDragToSelectRows="false" />
                    <ClientEvents   OnGridCreated="GridCreated" /> 


                </ClientSettings>   
            <PagerStyle Mode="NumericPages" />
        </telerik:RadGrid>
    </div>



.ascx.cs
 public partial class FileNameRule : UserControl
    {
        #region Properties&Variables


        private string _culture;


        private ResourceManager _resources;


        private RadAjaxManager AjaxManager { get; set; }


        private RadAjaxLoadingPanel Loading { get; set; }




        public List<WSFileNameRule> GetFileNameRuleList
        {
            get { return GetStringMaskList(); }
            set { LoadData(value); }
        }


        #endregion


        #region Events


        protected void Page_Load(object sender, EventArgs e)
        {
            LoadAjax();
        }


        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);


            GetInfo();
            LoadSettings();




            MyGrid.NeedDataSource += MyGrid_NeedSource;
            MyGrid.InsertCommand += MyGrid_InsertCommand;
            MyGrid.ItemCommand += MyGrid_ItemCommand;
            MyGrid.DeleteCommand += MyGrid_DeleteCommand;
            MyGrid.UpdateCommand += MyGrid_Updatecommand;
            MyGrid.ItemCreated += MyGrid_ItemCreated;
            MyGrid.ItemDataBound += MyGrid_ItemDataBound;
            MyGrid.RowDrop += MyGrid_RowDrop;
        }


        protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
            switch (e.Argument)
            {
                case "RebindAndNavigate":
                    RebindGrid();
                    break;




                case "DeleteAll":
                    Session["FileNameRule"] = null;
                    MyGrid.DataSource = new List<WSFileNameRule>();
                    MyGrid.Rebind();


                    break;


                case "DeleteSelected":
                    DeleteItSelectedItems();
                    break;
            }
        }


        #endregion


        #region Methods


        #region MyGridEvents


        protected void MyGrid_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item.IsInEditMode || (e.Item is IGridInsertItem))
            {
                LoadComboType(e);
                LoadComboValue(e);
                LoadComboField(e);


                (e.Item.FindControl("cbValue")).Visible = false;
                (e.Item.FindControl("txtValueInput")).Visible = false;
                (e.Item.FindControl("cbField")).Visible = true;
            }


            if (((e.Item is GridEditableItem) && (e.Item.IsInEditMode)) && !(e.Item.DataItem is GridInsertionObject))
            {
                var item = (GridEditableItem) e.Item;


                var mask = (WSFileNameRule) item.DataItem;


                RadComboBox cbValue = (RadComboBox) item.FindControl("cbValue");
                RadTextBox txtValueInput = (RadTextBox) item.FindControl("txtValueInput");
                RadComboBox cbField = (RadComboBox) item.FindControl("cbField");


                if (mask.TypeId == ((int)CatalogTypeEnum.LibraryType.Custom))
                {
                    cbValue.Visible = false;
                    txtValueInput.Visible = true;
                   
                    cbField.Visible = false;
                }
                else if (mask.TypeId == ((int)CatalogTypeEnum.LibraryType.Predefined))
                {
                    cbValue.Visible = true;
                    txtValueInput.Visible = false;
                    cbField.Visible = false;
                    txtValueInput.Text = null;
                }
                else if (mask.TypeId == ((int)CatalogTypeEnum.LibraryType.Field))
                {
                    cbValue.Visible = false;
                    txtValueInput.Visible = false;
                    cbField.Visible = true;
                    txtValueInput.Text = null;
                }
            }
        }


        protected void MyGrid_NeedSource(object sender, GridNeedDataSourceEventArgs e)
        {
            MyGrid.DataSource = (List<WSFileNameRule>) Session["FileNameRule"] ?? new List<WSFileNameRule>();
        }


        private void MyGrid_Updatecommand(object sender, GridCommandEventArgs e)
        {
            if (!Page.IsValid) return;
            var item = e.Item as GridEditableItem;
            var list = (List<WSFileNameRule>) Session["FileNameRule"];


            if (item != null)
            {
                object id = item.GetDataKeyValue("Id");


                WSFileNameRule mask = list.FindLast(x => x.Id == Convert.ToInt16(id));


                if (mask == null)
                {
                    list.Add(CreateObject(e, list.Count));
                }
                else
                {
                    UpdateObject(e, mask, Convert.ToInt16(id));
                }
            }


            list.Sort((x, y) => x.Position.CompareTo(y.Position));


            Session["FileNameRule"] = list;
            FormatExampleView(list);
            MyGrid.Rebind();
        }


        private void MyGrid_DeleteCommand(object sender, GridCommandEventArgs e)
        {
            if (e.Item == null)
            {
                e.Canceled = true;
                return;
            }


            object id = ((GridDataItem) e.Item).GetDataKeyValue("Id");


            var list = (List<WSFileNameRule>) Session["FileNameRule"];
            WSFileNameRule item = list.FindLast(x => x.Id == Convert.ToInt16(id));
            if (item != null) list.Remove(item);
            list.Sort((x, y) => x.Position.CompareTo(y.Position));


            Session["FileNameRule"] = list;
            FormatExampleView(list);
            MyGrid.Rebind();
        }


        protected void MyGrid_InsertCommand(object sender, GridCommandEventArgs e)
        {
            AddValues(CreateObject(e, 0));
        }


        protected void MyGrid_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.CommandName != RadGrid.UpdateCommandName)
            {
                if (e.CommandName == RadGrid.InitInsertCommandName && e.Item.OwnerTableView.IsItemInserted)
                {
                    e.Canceled = true;
                }


                if (e.CommandName == RadGrid.EditCommandName && e.Item.OwnerTableView.IsItemInserted)
                {
                    e.Canceled = true;
                }


                if (e.CommandName == RadGrid.EditCommandName && e.Item.OwnerTableView.ChildEditItems.Count > 0)
                {
                    e.Canceled = true;
                }


                if (e.CommandName == RadGrid.InitInsertCommandName && e.Item.OwnerTableView.ChildEditItems.Count > 0)
                {
                    e.Canceled = true;
                }
            }




            if (e.CommandName == RadGrid.PerformInsertCommandName)
            {
                var item = (GridDataItem) e.Item;


                //((RadNumericTextBox)item.FindControl("txtAmount")).Enabled = fvAmmountValidate;
                // ((RadNumericTextBox)item.FindControl("txtAmountTo")).Enabled = fvAmmountValidate;


                // ((RadTextBox)item.FindControl("txtChar")).Enabled = fvCharValidate;
            }


            if (e.CommandName == RadGrid.EditCommandName)
            {
                e.Item.OwnerTableView.IsItemInserted = false;
            }




            switch (e.CommandName)
            {
                case RadGrid.EditCommandName:
                case RadGrid.DeleteCommandName:
                    Session["ItemID"] = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"];
                    break;


                case "SelectRow":
                    Session["SelectedRows"] = MyGrid.MasterTableView.GetSelectedItems();
                    break;
            }
        }


        private void MyGrid_ItemCreated(object sender, GridItemEventArgs e)
        {
            var item = e.Item as GridCommandItem;
            if (item != null)
            {
                LoadLabelSettings(item);
            }
        }


        protected void MyGrid_RowDrop(object sender, GridDragDropEventArgs e)
        {
            if (e.DraggedItems.Count > 0 && e.DestDataItem != null)
            {
                var currentId = ((int) e.DraggedItems[0].GetDataKeyValue("Id"));
                var destionationId = ((int) e.DestDataItem.GetDataKeyValue("Id"));


                var list = (List<WSFileNameRule>) Session["FileNameRule"];


                int destinationOrderIndex = list.Find(x => x.Id == destionationId).Position;
                int orderIndex = list.Find(x => x.Id == currentId).Position;




                if (e.DropPosition == GridItemDropPosition.Below)
                {
                    destinationOrderIndex = destinationOrderIndex + 1;


                    WSFileNameRule itemNameRule =
                        list.Find(x => x.Position >= destinationOrderIndex && x.Id != currentId);
                    if (itemNameRule != null) itemNameRule.Position = itemNameRule.Position + 1;


                    itemNameRule = list.Find(x => x.Id == currentId);
                    itemNameRule.Position = destinationOrderIndex;
                }
                else if (e.DropPosition == GridItemDropPosition.Above)
                {
                    destinationOrderIndex = destinationOrderIndex - 1;


                    WSFileNameRule itemMask = list.Find(x => x.Position <= destinationOrderIndex && x.Id != currentId);
                    if (itemMask != null) itemMask.Position = itemMask.Position - 1;


                    itemMask = list.Find(x => x.Id == currentId);
                    itemMask.Position = destinationOrderIndex;
                }


                list.Sort((x, y) => x.Position.CompareTo(y.Position));
                Session["FileNameRule"] = list;
                FormatExampleView(list);


                MyGrid.DataSource = Session["FileNameRule"];
                MyGrid.Rebind();
            }
        }


        #endregion


        protected void cbType_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            var combo = (RadComboBox) sender;


            if (Session["ItemID"] != null && Convert.ToInt16(Session["ItemID"]) > 0)
            {
                var item = (GridDataItem) combo.NamingContainer;
                SelectedIdexChanged(item);
            }


            else
            {
                var item = (GridDataInsertItem) combo.NamingContainer;
                SelectedIdexChanged(item);
            }
        }




        public void DeleteSelectedItems(object sender, EventArgs eventArgs)
        {
            if (MyGrid.SelectedItems.Count > 0)
            {
                var RadWindowManager1 = Page.FindControl("RadWindowManager1") as RadWindowManager;


                RadWindowManager1.RadConfirm(
                    _resources.GetString("DeleteSelectedValuesText", new CultureInfo(_culture)),
                    "confirmCallBackDeleteSelectedListValues", 330,
                    100, null, _resources.GetString("DeleteSelectedValuesTitle", new CultureInfo(_culture)));
            }
        }


        public void DeleteValues(object sender, EventArgs eventArgs)
        {
            if (MyGrid.Items.Count > 0)
            {
                var RadWindowManager1 = Page.FindControl("RadWindowManager1") as RadWindowManager;


                RadWindowManager1.RadConfirm(
                    _resources.GetString("DeleteAllValuesText", new CultureInfo(_culture)),
                    "confirmCallBackDeleteAllListValues", 330,
                    100, null, _resources.GetString("DeleteAllValuesTitle", new CultureInfo(_culture)));
            }
        }


        #endregion


        #region PageMethods


        private void LoadAjax()
        {
            AjaxManager = Page.FindControl("RadAjaxManager1") as RadAjaxManager;
            AjaxManager.AjaxRequest += RadAjaxManager1_AjaxRequest;


            Loading = Page.FindControl("LoadCombo") as RadAjaxLoadingPanel;


            if (AjaxManager == null || Loading == null) return;


            AjaxManager.AjaxSettings.AddAjaxSetting(MyGrid, MyGrid, Loading);
            AjaxManager.AjaxSettings.AddAjaxSetting(MyGrid, lblShowAS, Loading);
            AjaxManager.AjaxSettings.AddAjaxSetting(AjaxManager, MyGrid, Loading);
        }


        private void GetInfo()
        {
            _culture = Variables.CurrentCulture();
            _resources = Components.GeneralFunctions.Resources.GetAdminUserControlResources("FileNameRule", "Library");
        }


        private void LoadSettings()
        {
            try
            {
                GridSettings();
                if (string.IsNullOrEmpty(_culture)) GetInfo();
                lblShowAsTitle.Text = _resources.GetString(lblShowAsTitle.ID, new CultureInfo(_culture));
            }
            catch (Exception ex)
            {
                Exception exc = ex;
            }
        }


        private void LoadData(List<WSFileNameRule> FileNameRules)
        {
            GetInfo();


            foreach (WSFileNameRule rule in FileNameRules)
            {
                
                rule.Type = _resources.GetString(rule.Type, new CultureInfo(_culture)) ?? rule.Type;
                if (rule.TypeId == (int)CatalogTypeEnum.LibraryType.Predefined) rule.ValueName = _resources.GetString(rule.ValueName, new CultureInfo(_culture)) ?? rule.ValueName;
            }


            Session["FileNameRule"] = FileNameRules;
            FormatExampleView(FileNameRules);
        }


        private void GridSettings()
        {
            CustomProperties(MyGrid); /* use common properties */
            GridFunction.SetHeaderName(MyGrid, _resources, null);
            GridFunction.GridOptions(MyGrid);
        }


        private void LoadLabelSettings(GridCommandItem item)
        {
            var lblQuickAdd = ((Label) item.FindControl("lblQuickAdd"));
            if (lblQuickAdd != null)
            {
                lblQuickAdd.Text = _resources.GetString(lblQuickAdd.ID, new CultureInfo(_culture));
                lblQuickAdd.ToolTip = _resources.GetString(lblQuickAdd.ID, new CultureInfo(_culture));
            }




            var lblDeleteAllValues = ((Label) item.FindControl("lblDeleteAllValues"));
            if (lblDeleteAllValues != null)
            {
                lblDeleteAllValues.Text = _resources.GetString(lblDeleteAllValues.ID, new CultureInfo(_culture));
                lblDeleteAllValues.ToolTip = _resources.GetString(lblDeleteAllValues.ID, new CultureInfo(_culture));
            }


            var lblDeleteSelected = ((Label) item.FindControl("lblDeleteSelected"));
            if (lblDeleteSelected != null)
            {
                lblDeleteSelected.Text = _resources.GetString(lblDeleteSelected.ID, new CultureInfo(_culture));
                lblDeleteSelected.ToolTip = _resources.GetString(lblDeleteSelected.ID, new CultureInfo(_culture));
            }
        }


        private void RebindGrid()
        {
            MyGrid.Rebind();
        }


        public void CustomProperties(RadGrid grid)
        {
            grid.AllowPaging = true;
            grid.AllowSorting = true;
            grid.CellSpacing = 0;
            grid.EnableHeaderContextMenu = false;
            grid.EnableHeaderContextFilterMenu = false;




            grid.AllowFilteringByColumn = true;
            grid.GridLines = GridLines.None;
            grid.Skin = "Vista";
            grid.Width = Unit.Percentage(100);
            grid.PageSize = 10;




            grid.ItemStyle.VerticalAlign = VerticalAlign.Middle;
            grid.GroupingSettings.CaseSensitive = false;


            grid.PagerStyle.AlwaysVisible = false;
            grid.PagerStyle.Mode = GridPagerMode.NumericPages;




            grid.ClientSettings.ActiveRowIndex = "true";
            grid.ClientSettings.AllowColumnHide = false;


            grid.ClientSettings.Resizing.AllowColumnResize = false;
            grid.ClientSettings.Resizing.ClipCellContentOnResize = true;
            grid.ClientSettings.Resizing.EnableRealTimeResize = true;


            grid.ClientSettings.Scrolling.AllowScroll = false;


            grid.ClientSettings.Scrolling.UseStaticHeaders = true;


            grid.Culture = new CultureInfo(Variables.CurrentCulture());




            grid.MasterTableView.GetColumnSafe("RowIndicator").Display = false;
            grid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;


            grid.MasterTableView.EditMode = GridEditMode.InPlace;
            grid.MasterTableView.Width = Unit.Percentage(100);
            grid.MasterTableView.EnableHeaderContextMenu = false;
        }


        #endregion


        #region GridMethods


        private void DeleteItSelectedItems()
        {
            var listValues = (List<WSFileNameRule>) Session["FileNameRule"];


            var selectedRow = (GridDataItem[]) Session["SelectedRows"];


            if (selectedRow.Length == 0)
            {
                return;
            }


            foreach (GridDataItem item in selectedRow)
            {
                string id = item.GetDataKeyValue("Id").ToString();
                string stringMaskId = item.GetDataKeyValue("LibraryId").ToString();
                listValues.Remove(listValues.Find(x => x.Id == Convert.ToInt16(id)));
            }




            Session["FileNameRule"] = listValues;
            Session["SelectedRows"] = null;
            MyGrid.Rebind();
        }


        private void AddValues(WSFileNameRule value)
        {
            var myValues = new List<WSFileNameRule>();


            if (Session["FileNameRule"] != null)
            {
                myValues = (List<WSFileNameRule>) Session["FileNameRule"];
            }


            if (myValues.Count == 0)
                value.Position = 1;
            else
            {
                value.Position = myValues.Count + 1;
            }




            myValues.Add(value);
            myValues.Sort((x, y) => x.Position.CompareTo(y.Position));


            Session["FileNameRule"] = myValues;
            FormatExampleView(myValues);




            MyGrid.DataSource = myValues;
            MyGrid.Rebind();
        }


        private void LoadComboType(GridItemEventArgs e)
        {
            var item = (GridEditableItem) e.Item;


            var combo = (RadComboBox) item.FindControl("cbType");




            combo.Items.Clear();




            List<WSCatalogDetails> result =
                new WSOrganization().GetCatalogDetail((int) CatalogTypeEnum.WS_Catalog.Library_Type);


            foreach (WSCatalogDetails itemDetail in result)
            {
                combo.Items.Add(
                    new RadComboBoxItem(
                        _resources.GetString(itemDetail.Text, new CultureInfo(_culture)), itemDetail.Id.ToString()));
            }


            combo.DataBind();


            if (!(e.Item is IGridInsertItem))
            {
                var fileNameRule = (WSFileNameRule) e.Item.DataItem;
                if (fileNameRule.TypeId != 0)
                    combo.SelectedValue = fileNameRule.TypeId.ToString();
            }


            combo.EmptyMessage = _resources.GetString("cbType", new CultureInfo(_culture));


            combo.DataBind();
        }


        private void LoadComboValue(GridItemEventArgs e)
        {
            var item = (GridEditableItem) e.Item;


            var combo = (RadComboBox) item.FindControl("cbValue");




            combo.Items.Clear();




            List<WSCatalogDetails> result =
                new WSOrganization().GetCatalogDetail((int) CatalogTypeEnum.WS_Catalog.Library_Type_Predefined);


            foreach (WSCatalogDetails itemDetail in result)
            {
                combo.Items.Add(
                    new RadComboBoxItem(
                        _resources.GetString(itemDetail.Text, new CultureInfo(_culture)), itemDetail.Id.ToString()));
            }


            combo.DataBind();


            if (!(e.Item is IGridInsertItem))
            {
                var fileNameRule = (WSFileNameRule) e.Item.DataItem;
                if (fileNameRule.ValueId != 0)
                    combo.SelectedValue = fileNameRule.ValueId.ToString();
            }


            combo.EmptyMessage = _resources.GetString("cbValue", new CultureInfo(_culture));


            combo.DataBind();
        }


        private void LoadComboField(GridItemEventArgs e)
        {
            var item = (GridEditableItem) e.Item;


            var combo = (RadComboBox) item.FindControl("cbField");


            combo.Items.Clear();


            //TODO: ask if show all field ( mark for delete and isn't active)
            List<WSField> result =
                new WSOrganization().GetAllFields((int) GlobalEnumeration.QueryFor.Admin);


            //foreach (WSField itemDetail in result)
            //{
            //    combo.Items.Add(new RadComboBoxItem(itemDetail.Header, itemDetail.Id.ToString()));
            //}


            //combo.DataBind();
            combo.DataSource = result;
            combo.DataBind();
            if (!(e.Item is IGridInsertItem))
            {
                var fileNameRule = (WSFileNameRule) e.Item.DataItem;
                if (fileNameRule.FieldId != 0)
                    combo.SelectedValue = fileNameRule.FieldId.ToString();
            }


            combo.EmptyMessage = _resources.GetString("cbField", new CultureInfo(_culture));


            combo.DataBind();
        }


        private void SelectedIdexChanged(GridDataInsertItem item)
        {
            var cbType = (RadComboBox) item.FindControl("cbType");


            (item.FindControl("cbValue")).Visible = false;
            (item.FindControl("txtValueInput")).Visible = true;
            (item.FindControl("cbField")).Visible = false;


            ShowControls(cbType.SelectedValue, (RadComboBox) item.FindControl("cbValue"),
                         (RadTextBox) item.FindControl("txtValueInput"), (RadComboBox) item.FindControl("cbField"), null);
        }


        private void ShowControls(string cbType, RadComboBox cbValue, RadTextBox txtValueInput, RadComboBox cbField, string value)
        {
           
            if (cbType == ((int) CatalogTypeEnum.LibraryType.Custom).ToString())
            {
                cbValue.Visible = false;
                txtValueInput.Visible = true;
                txtValueInput.Text = value;
                cbField.Visible = false;
            }
            else if (cbType == ((int) CatalogTypeEnum.LibraryType.Predefined).ToString())
            {
                cbValue.Visible = true;
                txtValueInput.Visible = false;
                cbField.Visible = false;
                txtValueInput.Text = null;
            }
            else if (cbType == ((int) CatalogTypeEnum.LibraryType.Field).ToString())
            {
                cbValue.Visible = false;
                txtValueInput.Visible = false;
                cbField.Visible = true;
                txtValueInput.Text = null;
            }


            Session["TypeId"] = cbType;
        }


        private void SelectedIdexChanged(GridDataItem item)
        {
            var cbType = (RadComboBox) item.FindControl("cbType");




            ShowControls(cbType.SelectedValue, (RadComboBox) item.FindControl("cbValue"),
                         (RadTextBox) item.FindControl("txtValueInput"), (RadComboBox) item.FindControl("cbField"), null);
        }


        private WSFileNameRule CreateObject(GridCommandEventArgs e, int countItem)
        {
            if (countItem == 0)
                countItem = Session["FileNameRule"] != null ? ((List<WSFileNameRule>) Session["FileNameRule"]).Count : 0;
            int LibraryId = Convert.ToInt32((Page.FindControl("hddId") as HiddenField).Value ?? "0");


            string valueId = string.IsNullOrEmpty(((RadComboBox) e.Item.FindControl("cbValue")).SelectedValue)
                                 ? "0"
                                 : ((RadComboBox) e.Item.FindControl("cbValue")).SelectedValue;


            string fieldId = string.IsNullOrEmpty(((RadComboBox) e.Item.FindControl("cbField")).SelectedValue)
                                 ? "0"
                                 : ((RadComboBox) e.Item.FindControl("cbField")).SelectedValue;


            var fileNameRule = new WSFileNameRule
                                   {
                                       Id = GetLastItemId(LibraryId),
                                       Position = countItem + 1,
                                       TypeId =
                                           Convert.ToInt16(((RadComboBox) e.Item.FindControl("cbType")).SelectedValue),
                                       ValueId = Convert.ToInt16(valueId),
                                       Value = ((RadTextBox) e.Item.FindControl("txtValueInput")).Text,
                                       FieldId = Convert.ToInt16(fieldId),
                                       FieldName = ((RadComboBox) e.Item.FindControl("cbField")).Text,
                                       Type = ((RadComboBox) e.Item.FindControl("cbType")).Text,
                                       ValueName = ((RadComboBox) e.Item.FindControl("cbValue")).Text,
                                   };
            return fileNameRule;
        }


        private int GetLastItemId(Int32 libraryId)
        {
            int tempId = 0;




            List<WSFileNameRule> myValues;


            if (Session["StringData"] != null)
            {
                myValues = (List<WSFileNameRule>) Session["FileNameRule"];
                int temp = new WSFileNameRule().GetFileNameRuleId(libraryId);


                if (myValues.Count == 0)
                {
                    myValues = new List<WSFileNameRule>();
                    tempId = temp != 1 && temp > 1 ? temp : 1;
                }
                else
                {
                    tempId = temp != 1 && temp > myValues[myValues.Count - 1].Id
                                 ? temp
                                 : myValues[myValues.Count - 1].Id + 1;
                }
            }
            else
            {
                myValues = new List<WSFileNameRule>();
                tempId = 1;
            }


            return tempId;
        }


        private void UpdateObject(GridCommandEventArgs e, WSFileNameRule fileNameRule, int Id)
        {
            string typeId = (Session["TypeId"] != null)
                                ? Session["TypeId"].ToString()
                                : ((RadComboBox) e.Item.FindControl("cbType")).SelectedValue;


            fileNameRule.Id = Id;
            fileNameRule.Position = Convert.ToInt16(((Label) e.Item.FindControl("lblPosition")).Text);


            fileNameRule.TypeId = Convert.ToInt16(typeId);
            fileNameRule.Type = ((RadComboBox) e.Item.FindControl("cbType")).Text;
            fileNameRule.ValueName = ((RadComboBox) e.Item.FindControl("cbValue")).Text;
            fileNameRule.FieldName = ((RadComboBox) e.Item.FindControl("cbField")).Text;
            string valueId = string.IsNullOrEmpty(((RadComboBox) e.Item.FindControl("cbValue")).SelectedValue)
                              ? "0"
                              : (((RadComboBox) e.Item.FindControl("cbValue")).SelectedValue);
            fileNameRule.ValueId = Convert.ToInt16(valueId);
           
            if (Convert.ToInt16(valueId) > 0)
            {
                fileNameRule.Value = null;
                fileNameRule.FieldName = null;
            }


            string fieldId = string.IsNullOrEmpty(((RadComboBox) e.Item.FindControl("cbField")).SelectedValue) ? "0" :
                (((RadComboBox) e.Item.FindControl("cbField")).SelectedValue)
            ;
            fileNameRule.FieldId = Convert.ToInt16(fieldId);


            if (Convert.ToInt16(fieldId) > 0)
            {
                fileNameRule.ValueName = null;
                fileNameRule.FieldName = null;
            }


            fileNameRule.Value = ((RadTextBox) e.Item.FindControl("txtValueInput")).Text;


            Session.Remove("TypeId");
        }


      


        private List<WSFileNameRule> GetStringMaskList()
        {
            List<WSFileNameRule> list = (List<WSFileNameRule>) Session["FileNameRule"] ?? new List<WSFileNameRule>();


            Session["FileNameRule"] = list;
            return list;
        }


        #region Validators


        protected void cvValueInput_ServerValidate(object source, ServerValidateEventArgs args)
        {
            var cvValueInput = (CustomValidator) source;
            Control row = cvValueInput.Parent;


            var cbType = (row.FindControl("cbType") as RadComboBox);


            if (cbType.SelectedValue == ((int) CatalogTypeEnum.LibraryType.Custom).ToString())
            {
                var txtValueInput = (row.FindControl("txtValueInput") as RadTextBox);
                if (string.IsNullOrEmpty(txtValueInput.Text)) args.IsValid = false;
                else args.IsValid = true;
            }
            else
            {
                args.IsValid = true;
            }
        }




        protected void cvValue_ServerValidate(object source, ServerValidateEventArgs args)
        {
            var cvValue = (CustomValidator) source;
            Control row = cvValue.Parent;


            var cbType = (row.FindControl("cbType") as RadComboBox);


            if (cbType.SelectedValue == ((int) CatalogTypeEnum.LibraryType.Predefined).ToString())
            {
                var cbValue = (row.FindControl("cbValue") as RadComboBox);
                if (string.IsNullOrEmpty(cbValue.SelectedValue)) args.IsValid = false;
                else args.IsValid = true;
            }
            else
            {
                args.IsValid = true;
            }
        }




        protected void cvField_ServerValidate(object source, ServerValidateEventArgs args)
        {
            var cvField = (CustomValidator) source;
            Control row = cvField.Parent;


            var cbType = (row.FindControl("cbType") as RadComboBox);


            if (cbType.SelectedValue == ((int) CatalogTypeEnum.LibraryType.Field).ToString())
            {
                var cbField = (row.FindControl("cbField") as RadComboBox);
                if (string.IsNullOrEmpty(cbField.SelectedValue)) args.IsValid = false;
                else args.IsValid = true;
            }
            else
            {
                args.IsValid = true;
            }
        }


        #endregion




        private void FormatExampleView(List<WSFileNameRule> list)
        {
            lblShowAS.Text = null;


            foreach (WSFileNameRule rule in list)
            {
                switch (rule.TypeId)
                {
                    case ((int)CatalogTypeEnum.LibraryType.Custom):
                        lblShowAS.Text += rule.Value;
                        break;


                    case ((int)CatalogTypeEnum.LibraryType.Predefined):


                        if (rule.ValueId == (int)CatalogTypeEnum.LibraryType_Value.FrontEnd)
                            lblShowAS.Text += @"\";
                        else
                        lblShowAS.Text += rule.ValueName;
                        break;


                    case ((int)CatalogTypeEnum.LibraryType.Field):
                        lblShowAS.Text += rule.FieldName;
                        break;


                  


                }
            }
        }


        #endregion
    }







Ivana
Telerik team
 answered on 12 Sep 2012
1 answer
70 views

I have the following hierarchical radgrid structure.i have a linkbutton inside the inner grid.i need to keep the expanded state of the grid once i click on the link button and rebind the grid. i have tried the http://www.telerik.com/community/code-library/aspnet-ajax/grid/retain-expanded-selected-state-in-hierarchy-on-rebind.aspx post but on the post back inner grid doesn't appear.plz help 

  <telerik:RadGrid ID="RadGrid1" OnPreRender="RadGrid1_PreRender" DataSourceID="SqlDataSource1"  
        runat="server" AutoGenerateColumns="False" AllowSorting="True" AllowMultiRowSelection="False"  Skin="Office2007" 
        AllowPaging="True" PageSize="5" GridLines="None" ShowGroupPanel="true" OnItemCreated="RadGrid1_ItemCreated"
        OnItemCommand="RadGrid1_ItemCommand" OnDataBound="RadGrid1_DataBound">
        <PagerStyle Mode="NumericPages"></PagerStyle>
        <MasterTableView DataSourceID="SqlDataSource1" DataKeyNames="ProjectID" AllowMultiColumnSorting="True"
            GroupLoadMode="Server">
            <NestedViewTemplate>
                <asp:Panel runat="server" ID="InnerContainer" CssClass="viewWrap" Visible="false">
                    <telerik:RadTabStrip runat="server" ID="TabStip1" MultiPageID="Multipage1" SelectedIndex="0" >
                        <Tabs>
                            <telerik:RadTab runat="server" Text="Major Release" PageViewID="PageView1">
                            </telerik:RadTab>
                            <telerik:RadTab runat="server" Text="Minor Release" PageViewID="PageView2">
                            </telerik:RadTab>
                          
                        </Tabs>
                    </telerik:RadTabStrip>
                    <telerik:RadMultiPage runat="server" ID="Multipage1" SelectedIndex="0" RenderSelectedPageOnly="false">
                        <telerik:RadPageView runat="server" ID="PageView1">
                            <asp:Label ID="Label1" Font-Bold="true" Font-Italic="true" Text='<%# Eval("ProjectID") %>'
                                Visible="false" runat="server" />
                            <telerik:RadGrid runat="server" ID="OrdersGrid" DataSourceID="SqlDataSource2" ShowFooter="true"  
                                AllowSorting="true" EnableLinqExpressions="false">
                                <MasterTableView ShowHeader="true" AutoGenerateColumns="False" AllowPaging="true"
                                    DataKeyNames="VersionID" PageSize="7" HierarchyLoadMode="ServerOnDemand">
                                    <DetailTables>
                                        <telerik:GridTableView AutoGenerateColumns="false" DataKeyNames="VersionID" DataSourceID="SqlDataSource3"
                                            Width="100%">
                                            <ParentTableRelation>
                                                <telerik:GridRelationFields DetailKeyField="VersionID" MasterKeyField="VersionID" />
                                            </ParentTableRelation>
                                            <Columns>
                                                <telerik:GridBoundColumn SortExpression="ItemCode" HeaderText="Item Code" HeaderButtonType="TextButton"
                                                    DataField="ItemCode" UniqueName="ItemCode">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn SortExpression="ItemDescription" HeaderText="Item Description" HeaderButtonType="TextButton"
                                                    DataField="ItemDescription" UniqueName="ItemDescription">
                                                </telerik:GridBoundColumn>
                                               
                                            </Columns>
                                            <SortExpressions>
                                                <telerik:GridSortExpression FieldName="ItemCode" SortOrder="Descending"></telerik:GridSortExpression>
                                            </SortExpressions>
                                        </telerik:GridTableView>
                                    </DetailTables>
                                    <Columns>
                                        <telerik:GridBoundColumn SortExpression="VersionNo" HeaderText="Version No." HeaderButtonType="TextButton"
                                            DataField="VersionNo" UniqueName="VersionNo">
                                        </telerik:GridBoundColumn>
                                         <telerik:GridBoundColumn SortExpression="ModuleName" HeaderText="Module Name" HeaderButtonType="TextButton"
                                            DataField="ModuleName" UniqueName="ModuleName">
                                        </telerik:GridBoundColumn>
                                          <telerik:GridBoundColumn SortExpression="ApplicationName" HeaderText="Application Name" HeaderButtonType="TextButton"
                                            DataField="ApplicationName" UniqueName="ApplicationName">
                                        </telerik:GridBoundColumn>
                                         <telerik:GridBoundColumn SortExpression="Date" HeaderText="Relase Date" HeaderButtonType="TextButton"
                                            DataField="Date" UniqueName="Date"  DataFormatString="{0:dd/MM/yyyy}">
                                        </telerik:GridBoundColumn>
                                        <%-- <telerik:GridBoundColumn SortExpression="Confirmation" HeaderText="Confirmation" HeaderButtonType="TextButton"
                                            DataField="Confirmation" UniqueName="Confirmation">
                                        </telerik:GridBoundColumn>--%>
                                       <telerik:GridTemplateColumn HeaderText="Confirmation">
                                       <ItemTemplate>
                                       
                                          <asp:LinkButton ID="lbConfirmaton" runat="server" CommandArgument='<%# Eval("VersionID")%>' Text='<%# Eval("Confirmation") %>' OnCommand="lbConfirmaton_Click"></asp:LinkButton>
                                      
                                       </ItemTemplate>
                                       </telerik:GridTemplateColumn>
                                    </Columns>
                                </MasterTableView>
                            </telerik:RadGrid>
                            <asp:SqlDataSource ID="SqlDataSource2" ConnectionString="<%$ ConnectionStrings:ConVersionControl %>"
                                ProviderName="System.Data.SqlClient" SelectCommand="select p.ProjectID,p.ProjectName,v.VersionID,
                                v.VersionNo,v.Date,v.Confirmation,v.VersionType,v.ModuleID,m.ModuleName,a.ApplicationName  
from 
tblProject p inner join tblApplication a on a.ProjectID=p.ProjectID inner join
 tblVersion v on a.ApplicationID=v.ApplicationID inner join tblModule m
on m.ModuleID=v.ModuleID
where p.ProjectID=@ProjectID and v.VersionType='Major'
 order by m.ModuleName asc"
                                runat="server">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="Label1" PropertyName="Text" Type="String" Name="ProjectID" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                            <asp:SqlDataSource ID="SqlDataSource3" ConnectionString="<%$ ConnectionStrings:ConVersionControl %>"
                                ProviderName="System.Data.SqlClient" SelectCommand="
                               select p.ProjectID,p.ProjectName,v.VersionID,v.VersionNo,v.Date,v.Confirmation,v.VersionType,v.Confirmation
,m.ModuleID,t.ItemID,t.ItemCode,t.ItemDescription,m.ModuleName,a.ApplicationName
 from
tblProject p inner join tblApplication a
 on a.ProjectID=p.ProjectID inner join
 tblVersion v on a.ApplicationID=
v.ApplicationID
inner join tblItem t on t.VersionID=v.VersionID
inner join tblModule m on m.ModuleID=v.ModuleID
where v.VersionType='Major' and v.VersionID=@VersionID and p.ProjectID=@ProjectID"
                                runat="server">
                                <SelectParameters>
                                    <asp:SessionParameter Name="VersionID" SessionField="VersionID" Type="Int32" />
                                      <asp:ControlParameter ControlID="Label1" PropertyName="Text" Type="String" Name="ProjectID" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                        </telerik:RadPageView>
                        <telerik:RadPageView runat="server" ID="PageView2">
                           <telerik:RadGrid runat="server" ID="RadGrid2" DataSourceID="SqlDataSource5" ShowFooter="true" 
                                AllowSorting="true" EnableLinqExpressions="false">
                                <MasterTableView ShowHeader="true" AutoGenerateColumns="False" AllowPaging="true"
                                    DataKeyNames="VersionID" PageSize="7" HierarchyLoadMode="ServerOnDemand">
                                    <DetailTables>
                                        <telerik:GridTableView AutoGenerateColumns="false" DataKeyNames="VersionID" DataSourceID="SqlDataSource6"
                                            Width="100%">
                                            <ParentTableRelation>
                                                <telerik:GridRelationFields DetailKeyField="VersionID" MasterKeyField="VersionID" />
                                            </ParentTableRelation>
                                            <Columns>
                                                <telerik:GridBoundColumn SortExpression="ItemCode" HeaderText="Item Code" HeaderButtonType="TextButton"
                                                    DataField="ItemCode" UniqueName="ItemCode">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn SortExpression="ItemDescription" HeaderText="Item Description" HeaderButtonType="TextButton"
                                                    DataField="ItemDescription" UniqueName="ItemDescription">
                                                </telerik:GridBoundColumn>
                                               
                                            </Columns>
                                            <SortExpressions>
                                                <telerik:GridSortExpression FieldName="ItemCode" SortOrder="Descending"></telerik:GridSortExpression>
                                            </SortExpressions>
                                        </telerik:GridTableView>
                                    </DetailTables>
                                    <Columns>
                                        <telerik:GridBoundColumn SortExpression="VersionNo" HeaderText="Version No." HeaderButtonType="TextButton"
                                            DataField="VersionNo" UniqueName="VersionNo">
                                        </telerik:GridBoundColumn>
                                         <telerik:GridBoundColumn SortExpression="ModuleName" HeaderText="Module Name" HeaderButtonType="TextButton"
                                            DataField="ModuleName" UniqueName="ModuleName">
                                        </telerik:GridBoundColumn>
                                         <telerik:GridBoundColumn SortExpression="ApplicationName" HeaderText="Application Name" HeaderButtonType="TextButton"
                                            DataField="ApplicationName" UniqueName="ApplicationName">
                                        </telerik:GridBoundColumn>
                                         <telerik:GridBoundColumn SortExpression="Date" HeaderText="Relase Date" HeaderButtonType="TextButton"
                                            DataField="Date" UniqueName="Date"  DataFormatString="{0:dd/MM/yyyy}">
                                        </telerik:GridBoundColumn>
                                         <%--<telerik:GridBoundColumn SortExpression="Confirmation" HeaderText="Confirmation" HeaderButtonType="TextButton"
                                            DataField="Confirmation" UniqueName="Confirmation">
                                        </telerik:GridBoundColumn>--%>
                                        <telerik:GridTemplateColumn HeaderText="Confirmation">
                                       <ItemTemplate>
                                           <asp:LinkButton ID="lbConfirmaton" runat="server" CommandArgument='<%# Eval("VersionID")%>' Text='<%# Eval("Confirmation") %>' OnCommand="lbConfirmaton_Click"></asp:LinkButton>
                                       </ItemTemplate>
                                       </telerik:GridTemplateColumn>
                                    </Columns>
                                </MasterTableView>
                            </telerik:RadGrid>
                            <asp:SqlDataSource ID="SqlDataSource5" ConnectionString="<%$ ConnectionStrings:ConVersionControl %>"
                                ProviderName="System.Data.SqlClient" SelectCommand="select p.ProjectID,p.ProjectName,v.VersionID,v.VersionNo,v.Date,v.Confirmation,
                                v.VersionType,v.ModuleID,m.ModuleName,a.ApplicationName  
from 
tblProject p inner join tblApplication a
 on a.ProjectID=p.ProjectID inner join
 tblVersion v on a.ApplicationID=
v.ApplicationID inner join tblModule m
on m.ModuleID=v.ModuleID
where p.ProjectID=@ProjectID and v.VersionType='Minor'
 order by m.ModuleName asc"
                                runat="server">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="Label1" PropertyName="Text" Type="String" Name="ProjectID" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                            <asp:SqlDataSource ID="SqlDataSource6" ConnectionString="<%$ ConnectionStrings:ConVersionControl %>"
                                ProviderName="System.Data.SqlClient" SelectCommand="
                               select p.ProjectID,p.ProjectName,v.VersionID,v.VersionNo,v.Date,v.Confirmation,v.VersionType
,m.ModuleID,t.ItemID,t.ItemCode,t.ItemDescription,m.ModuleName
 from
tblProject p inner join tblApplication a
 on a.ProjectID=p.ProjectID inner join
 tblVersion v on a.ApplicationID=
v.ApplicationID
inner join tblItem t on t.VersionID=v.VersionID
inner join tblModule m on m.ModuleID=v.ModuleID
where v.VersionType='Minor' and v.VersionID=@VersionID and p.ProjectID=@ProjectID"
                                runat="server">
                                <SelectParameters>
                                    <asp:SessionParameter Name="VersionID" SessionField="VersionID" Type="Int32"/>
                                      <asp:ControlParameter ControlID="Label1" PropertyName="Text" Type="String" Name="ProjectID" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                        </telerik:RadPageView>
                       
                    </telerik:RadMultiPage>
                </asp:Panel>
            </NestedViewTemplate>
            <Columns>
                <telerik:GridBoundColumn SortExpression="ProjectName" HeaderText="Project Name" HeaderButtonType="TextButton"
                    DataField="ProjectName" UniqueName="ProjectName">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn SortExpression="VersionNo" HeaderText="Latest Version No." HeaderButtonType="TextButton"
                    DataField="VersionNo" UniqueName="VersionNo">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn SortExpression="RelaseDate" DataFormatString="{0:dd/MM/yyyy}"
                    HeaderText="Relase Date" HeaderButtonType="TextButton" DataField="RelaseDate" UniqueName="RelaseDate">
                </telerik:GridBoundColumn>
               
            </Columns>
        </MasterTableView>
        <ClientSettings AllowDragToGroup="true" />
    </telerik:RadGrid>
Radoslav
Telerik team
 answered on 12 Sep 2012
4 answers
101 views
Is there a way to find out if the event was cancelled on the server after calling grid table view updateItem method from the client?
Hosney
Top achievements
Rank 1
 answered on 12 Sep 2012
3 answers
159 views
Hi,

    I have a tree view with folder structure. when i double click on any folder it displays all files and folder in a grid. that grid consisiting of context menu with some options. now my question is how to display context menu on grid when i double click on folder if that folder contains no records and folders(means displaying context menu on empty Rad Grid).

Thanks in adv
usha.
Antonio Stoilkov
Telerik team
 answered on 12 Sep 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?