Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
218 views

I am attempting to utilize the following demo to create two RadGrids that allow me to drag and drop elements between them.  When I drag from one grid to the second it fires the onrowdrop function but doesn't actually drop the row item into the second grid.

Grid - Items Drag-and-drop

any help would be great

 

<%@ Page Title="" Language="VB" MasterPageFile="~/Masters/SetupMaintenance.master" AutoEventWireup="false" CodeFile="WebsiteMenuMaintenance.aspx.vb" Inherits="WebsiteMenuMaintenance" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Src="~/UserControls/CampaignSelection.ascx" TagPrefix="uc1" TagName="CampaignSelection" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentHeader" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentMain" runat="Server">
 
    <asp:HiddenField ID="hiddenCampaign_Key" runat="server" />
    <asp:HiddenField ID="CampaignCategoryHeader_Id" runat="server" />
    <asp:HiddenField ID="HiddenCampaignCategoryHeaderDetail_Id" runat="server" />
    <input id="hiddenMenu_Id" type="hidden" name="hiddenMenu_Id" runat="server" />
    <input id="hiddenMenu_Key" type="hidden" name="hiddenMenu_Key" runat="server" />
    <input id="hiddenMenuDetailParent_Key" type="hidden" name="hiddenMenuDetailParent_Key" runat="server" />
    <input id="hiddenMenuDetail_Id" type="hidden" name="hiddenMenuDetail_Id" runat="server" />
    <input id="hiddenMenuDetail_Key" type="hidden" name="hiddenMenuDetail_Key" runat="server" />
 
    <asp:Label runat="server" ID="lblError" />
    <uc1:CampaignSelection runat="server" ID="CampaignSelection" InlcudeAllCampaignsChoice="True" />
    <div class="row">
        <div class="col-md-6">
            <h3>Current Menus</h3>
        </div>
        <div class="col-md-6 text-right">
            <h3>
                <asp:LinkButton ID="lnkNewMenu" runat="server" ToolTip="Add a New Menu" CssClass="iconAction"><i class="glyphicon glyphicon-plus"></i> Add</asp:LinkButton></h3>
        </div>
 
    </div>
    <%--<div class="row">
        <div class="col-md-2">
            <div id="Templates">
                <telerik:radgrid ID="radMenuTree" runat="server" ShowLineImages="false" Width="100%" Style="white-space: normal;">
                </telerik:radgrid>
            </div>
        </div>
        </div>
        <div class="col-md-10">
            <div id="EditMenu">
                <div class="row">
                    <div class="col-md-6">
                        <h3>Menu Option</h3>
                    </div>
                    <div class="col-md-6 text-right">
                        <h3>
                            <asp:LinkButton ID="lnkSave" runat="server" CssClass="lnkSave" CommandName="SaveHTML" OnClientClick="SaveHTMLCONTENT()"><i class="glyphicon glyphicon-save"></i>Save</asp:LinkButton></h3>
                    </div>
                </div>--%>
                 
                      
                        <telerik:RadSkinManager runat="server" id="RadSkinManager1" showChooser="false" />
                        <script type="text/javascript">
                            ; (function ($, undefined) {
                                var grdAvailableMenus;
                                var grdMainMenus;
 
                                //var demo = window.demo = {};
                                
                                onGridCreated = function (sender, args) {                                                                  
                                    grdAvailableMenus = $telerik.findControl(document, "grdAvailableMenus");
                                    grdAvailableMenus = sender;
                                     
                                }
                                onRowDropping = function (sender, args) {
                                    alert("Row Dropping")
                                    alert(sender.get_id)
                                    console.log(sender);
                                    //if (sender.get_id() == grdAvailableMenus.get_id()) {
                                    var node = args.get_destinationHtmlElement();
 
                                        if (!isChildOf(grdMainMenus.get_id(), node) && !isChildOf(grdAvailableMenus.get_id(), node)) {
                                            //args.set_cancel(true);
                                            alert(grdAvailableMenus)
                                           
                                            
 
                                        }
                                   // }
                                    else {
                                        var node = args.get_destinationHtmlElement();
                                        alert(node)
                                        if (!isChildOf('trashCan', node)) {
                                            args.set_cancel(true);
                                        }
                                        else {
                                            if (confirm("Are you sure you want to delete this menu?"))
                                                args.set_destinationHtmlElement($get('trashCan'));
                                            else
                                                args.set_cancel(true);
                                        }
                                    }
                                };
 
                                function isChildOf(parentId, element) {
                                    while (element) {
                                        if (element.id && element.id.indexOf(parentId) > -1) {
                                            return true;
                                        }
                                        element = element.parentNode;
                                    }
                                    return false;
                                };
                            })($telerik.$);
                        </script>
                        <telerik:RadFormDecorator RenderMode="Lightweight" ID="RadFormDecorator1" DecorationZoneID="msgTop" DecoratedControls="CheckBoxes, Label" runat="server" Skin="Silk" EnableRoundeCorners="True" />
                        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"></telerik:RadAjaxLoadingPanel>
                        <telerik:RadAjaxManager runat="server" id="RadAjax" DefaultLoadingPanelID="RadAjaxLoadingPanek1">
                            <AjaxSettings>
                                <telerik:AjaxSetting AjaxControlID="grdAvailableMenus">
                                    <UpdatedControls>
                                        <telerik:AjaxUpdatedControl ControlID="grdAvailableMenus" />
                                        <Telerik:AjaxUpdatedControl ControlID="grdMainMenus" />
                                        <telerik:AjaxUpdatedControl ControlID="msg" />                                                                              
                                    </UpdatedControls>
                                </telerik:AjaxSetting>
                                <telerik:AjaxSetting AjaxControlID="grdMainMenus" >
                                    <UpdatedControls>
                                        <telerik:AjaxUpdatedControl ControlID="grdMainMenus" />
                                        <telerik:AjaxUpdatedControl ControlID="msg" />
                                    </UpdatedControls>
                                </telerik:AjaxSetting>
                                <telerik:AjaxSetting AjaxControlID="UseDragColumnCheckBox">
                                    <UpdatedControls>
                                        <telerik:AjaxUpdatedControl ControlID="grdAvailableMenus" />
                                        <telerik:AjaxUpdatedControl ControlID="grdMainMenus" />
                                    </UpdatedControls>
                                </telerik:AjaxSetting>
                            </AjaxSettings>
                        </telerik:RadAjaxManager>
                <div class="row">
                    <div class="col-md-12">
                        <telerik:RadGrid Rendermode="Lightweight" runat="server" ID="grdAvailableMenus" Skin="Silk" OnNeedDataSource="grdAvailableMenus_NeedDataSource" AllowPaging="true"
                             OnRowDrop="grdAvailableMenus_RowDrop" AutoGenerateColumns="false" AllowMultiRowSelection="true" PageSize="15">
                            <MasterTableView AllowMultiColumnSorting="True" DataKeyNames="Menu_Id">
                                    <Columns>
                                        <telerik:GridDragDropColumn HeaderStyle-Width="18px">
                                        </telerik:GridDragDropColumn>
                                        <telerik:GridTemplateColumn SortExpression="" Visible="false" HeaderText="Action" ItemStyle-HorizontalAlign="Left"
                                            ItemStyle-Width="70px" HeaderStyle-Width="70px">
                                            <ItemTemplate>
                                                <asp:ImageButton ID="btnUpdate" runat="server" Visible="false" CommandName="UpdateMenuStage" ImageUrl="images/pencil.gif"
                                                    CommandArgument='<%# Eval("Menu_Id") %>'
                                                    CausesValidation="false" ToolTip="Update Menu Stage" OnClientClick="SetMenuStageMode();" />  
                                        <asp:ImageButton ID="btnDelete" runat="server" Visible="false" CommandName="DeleteMenuStage" ImageUrl="Images/delete.gif"
                                            CommandArgument='<%# Eval("Menu_Id") %>'
                                            CausesValidation='false' ToolTip="Delete Menu Stage" />
                                            </ItemTemplate>
                                        </telerik:GridTemplateColumn>
                                        <telerik:GridTemplateColumn Visible="True" SortExpression="MenuName" HeaderText="Menu Name">
                                            <ItemTemplate>
                                               <asp:Label ID="lblMenu_Stage_Id" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Menu_Name") %>' />
                                            </ItemTemplate>
                                        </telerik:GridTemplateColumn>
                                       
                                             
                                         
                                    </Columns>
                                </MasterTableView>
                             
                                <ClientSettings AllowRowsDragDrop="true" AllowColumnsReorder="true" ReorderColumnsOnClient="false">                                   
                                    <ClientEvents OnRowDropping="onRowDropping" />                                 
                                    <Scrolling AllowScroll="True" UseStaticHeaders="false" SaveScrollPosition="True"></Scrolling>
                                    <Selecting AllowRowSelect="True" EnableDragToSelectRows="false" />
                                </ClientSettings>
                            </telerik:RadGrid>
                        <div class="demo-container" style="width: 750px;">
        <div class="exWrap">
            <div class="msgTop" id="msgTop">
                <asp:CheckBox ID="UseDragColumnCheckBox" Checked="true" Visible="false" runat="server" OnCheckedChanged="UseDragColumnCheckBox_CheckedChanged"
                    AutoPostBack="true" Text="Use DragDropColumn"></asp:CheckBox>
            </div>
                       <telerik:RadGrid RenderMode="Lightweight" runat="server" AllowPaging="True"  Skin="Silk"  ID="grdMainMenus" OnNeedDataSource="grdMainMenus_NeedDataSource"
                    Width="350px" AutoGenerateColumns="false"  AllowMultiRowSelection="true" OnRowDrop="grdMainMenus_RowDrop">
                    <MasterTableView DataKeyNames="Menu_Id" Width="100%">
                        <Columns>
                            <telerik:GridDragDropColumn HeaderStyle-Width="18px" Visible="true">                              
                            </telerik:GridDragDropColumn>
                            <telerik:GridTemplateColumn Visible="True" SortExpression="MenuName" HeaderText="">
                            </telerik:GridTemplateColumn>          
                            <telerik:GridTemplateColumn Visible="True" SortExpression="MenuName" HeaderText="Menu Name">
                                            <ItemTemplate>
                                           <asp:Label ID="lblMenu_Stage_Id" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Menu_Name") %>' />
                                            </ItemTemplate>
                                        </telerik:GridTemplateColumn>                  
                              
                        </Columns>
                        <NoRecordsTemplate>
                            <div style="height: 30px; cursor: pointer;">
                                No items to view
                            </div>
                        </NoRecordsTemplate>
                        <PagerStyle Mode="NumericPages" PageButtonCount="4"></PagerStyle>
                    </MasterTableView>
                    <ClientSettings AllowRowsDragDrop="True">
                        <Selecting AllowRowSelect="True" EnableDragToSelectRows="false"></Selecting>
                       <ClientEvents OnRowDropping="onRowDropping" OnGridCreated="onGridCreated"></ClientEvents>
                    </ClientSettings>
                </telerik:RadGrid>
               </div>
</div>
</div>               
 
 
                         
                        </div>
                    </div>
                </div>
          
     
</asp:Content>
 
<ASP:Content ID = "Content4" ContentPlaceHolderID="ContentFooter" runat="Server">
    <input id = "hiddenVisible" type="hidden" name="hiddenVisible" Class="hiddenVisible" runat="server" value="up" />
 
    <Telerik:RadCodeBlock ID = "RadCodeBlock1" runat="server">
        <Script type = "text/javascript" language="javascript">
 
            'use strict';
 
            $(document).ready(function () {
            });
        </script>
    </telerik:RadCodeBlock>
    <ASP:GridView ID = "ControlGrid" runat="server" BackColor="White" CellPadding="2" CellSpacing="1"
        GridLines="None" AutoGenerateColumns="False" Visible="False">   
    </asp:GridView>
</asp:Content>
Konstantin Dikov
Telerik team
 answered on 26 Oct 2016
1 answer
50 views

Did anyone else miss the October 25th Webinar?  I reserved a seat but have not gotten anything beyond the "you reserved a seat" message.  Everything I have indicates it should have taken place 1 hour ago but I have not gotten any URL to connect to or any login information.

 

Hopefully we can see the replay later???

Marin Bratanov
Telerik team
 answered on 26 Oct 2016
1 answer
126 views

We have multiple applications that are separate but related.

Each application has multiple instances of controls that we would like to persist the state for in SQL.

When storing this is it just using the control ID to uniquely identify the settings for that particular control?

Essentially, do I need to worry about naming collisions across applications and store a separate record for each application?

Obviously this will inform the table schema and the implementation of the provider that are needed.

Kostadin
Telerik team
 answered on 26 Oct 2016
5 answers
296 views

I have a RadFilter and select the function "equals" and the text "Peru" and when I press the Apply button, no results found. But radgrid column exists in the text column country "Perú" with accent, I tried putting the property: <GroupingSettings CaseSensitive = "false"> </ GroupingSettings>, but only ignores case sensitive, I need to omit the accents.
Attached image.

Please any advice?

 PDT:

In basic search I succeeded with SP where the condition COLLATE establish Latin1_General_CI_AI, I need to achieve the same result with RadFilter.
Attached image: Search Search basic.png and basic sp.png​

Thanks.
Isabel
Top achievements
Rank 1
 answered on 26 Oct 2016
1 answer
122 views

Hello,

 

I am trying to export the OrgChart to pdf, I have followed the tips in previous posts, my chart contains Arabic characters which printed wrongly or not printed at all in pdf like in attachments.

 

any Idea how to solve this please?

 

Thanks

 

 

 

 

Dimitar
Telerik team
 answered on 26 Oct 2016
1 answer
131 views

In a loop, I Can update the status for every record. So i need to show the status of record after the every single record updated. These should done when the button is clicked.
When i click start button it should updated the every record status in loop. Then i need to show every record status for every updates in UI.

protected void btnstart_Click(object sender, EventArgs e)
    {
        string pageId = string.Empty;
        divMsg.Style.Add("display", "none");
        divMsg.Attributes.Add("class", "");
        try
        {
 
            DataSet DsPages = (DataSet)ViewState["SitePages"];
            bool IsSucess = false, IsError = false;
            string SqlQuery = string.Empty;
            if (DsPages.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < DsPages.Tables[0].Rows.Count; i++)
                {
                    try
                    {
                        htmlClean(DsPages.Tables[0].Rows[i]["contents"].ToString());
                        pageId = DsPages.Tables[0].Rows[i]["ID"].ToString();
                        SqlQuery = TransformXMLToHTML(htmldesign.InnerText, txtPageTypeXslt.InnerText.Trim());
                        SqlQuery = SqlQuery.Replace("<?xml version=\"1.0\" encoding=\"utf-16\"?>", "");
                        PagesBL objPage = new PagesBL(1);
                        if (!string.IsNullOrEmpty(SqlQuery))
                        {
                            if (objPage.ExecuteQuery(SqlQuery) > 0)
                            {
                                PagesBL objPageBL = new PagesBL();
                                objPageBL.UpdateLastExtract(DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss"), DsPages.Tables[0].Rows[i]["ID"].ToString());                               
                                IsSucess = true;
                            }
 
                        }
                    }
                    catch (Exception ex)
                    {
                        IsError = true;
                        string Error = ex.Message;
                        PagesBL objPageBL = new PagesBL();
                        Errors objErr = new Errors();
                        objErr.PageID = pageId;
                        objErr.ErrorOccuredOn = DateTime.Now;
                        objErr.ErrorText = ex.Message;
                        objErr.SQLError = ex.Source == ".Net SqlClient Data Provider" ? SqlQuery : ex.Message;
                        objErr.ErrorStatus = 1; //1=
                        objPageBL.InsertErrors(objErr);
                        // divMsg.Attributes.Add("class", "alert alert-danger");
                        // divMsg.InnerText = "Extract process complete with few error.Please check the error list";
                    }
                }
                if (IsSucess && !IsError)
                {
                    Session["Complete"] = "True";
                    divMsg.Style.Add("display", "block");
                    divMsg.Attributes.Add("class", "alert alert-success");
                    divMsg.InnerText = "Extract process completed.";
                }
            }
        }
        catch (Exception ex)
        {
 
        }
}
Marin Bratanov
Telerik team
 answered on 26 Oct 2016
15 answers
295 views

Hi,

I'm working on a legacy ASP.NET WebForms project and I am to add accessibility to the project.

My predecessor already tried to add accessibility by manually assigning an access key to the AccessKey property of some of the PanelBar's RadPanelItemCollection elements (see attachment #1).

 

 

Plamen
Telerik team
 answered on 26 Oct 2016
1 answer
74 views

Hello,
I am using a RadGrid with multiple columns which can be edited (BatchEdit like excel).

<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" runat="server" AutoGenerateColumns="False"GridLines="Both"OnNeedDataSource="RadGrid1_NeedDataSource" AllowAutomaticInserts="True" AllowAutomaticUpdates="True"AllowAutomaticDeletes="True">
            <ItemStyle Wrap="false" />
            <MasterTableView TableLayout="Fixed" NoMasterRecordsText="" ShowFooter="true" EditMode="Batch">
                ...
            </MasterTableView>
</telerik:RadGrid>


Datasource of RadGrid is ObjectDataSource

<asp:ObjectDataSource ID="TestSource" runat="server" TypeName="TestClass" SelectMethod="GetAllItems">
      <UpdateParameters>
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="LastName" Type="String" />
                <asp:Parameter Name="BirthData" Type="DateTime" />
      </UpdateParameters>
</asp:ObjectDataSource>


On OnNeedDataSource event I'm setting Id of ObjectDataSource to RadGrid.DataSourceId.

protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
        RadGrid1.DataSourceID = "TestSource";
}


In current Page I have also button "Send email" send rad gird inserted values.
<asp:Button ID="SendEmail" OnClick="SendEmail_Click" Text="Send" runat="server" />

Problem is that on SendEmail_Click DataSource is null. But I want to get newly changed DataSource.

protected void SendEmail_Click(object sender, EventArgs e)
{
        RadGrid1.Rebind();
        // RadGrid1.Datasource is null
}

 

How I can solve this problem?

 

Thanks,

Daler

Pavlina
Telerik team
 answered on 25 Oct 2016
5 answers
199 views
I have an RadGrid with an Editform template that contains a RadAjaxPanel control with a sub-gird inside panel. I am using the RadAjaxPanel to help eliminate the page refresh when performing updates to the data inside the editform template.  I use a RadAjaxLoadingPanel with all default values so that when the sub-grid is updated the loading image shows and the whole page will not refresh.  However, I noticed that if I refresh or rebind the sub-grid it causes the parent grid to refresh as well.  So the setup looks something like this.

<telerik:RadGrid ID="MyParentGrid ... >
   {Databound Columns}
   ...
  <EditFormSettings EditFormType="Template" EditColumn-HeaderButtonType="LinkButton">
      <EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column"></EditColumn>
                <FormTemplate> 
                   <telerik:RadAjaxPanel ID="EditArea" runat="server" Visible='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "false", "true") %>'  BorderStyle="Solid" BorderWidth="1px" LoadingPanelID="RadAjaxLoadingPanel1"> 
                                          
                                           <telerik:RadGrid ID="MyChildGrid" ... >
                                           </telerik:RadGrid>

                   </telerik:RadAjaxPanel...>
                    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">
                    </telerik:RadAjaxLoadingPanel>
                </FormTemplate> 
         </EditFormSettings>
</telerik:RadGrid>

Is there something I need to do to isolate the update of the sub-grid from the parent grid?  Do I need an AjaxManager inside the EditForm Template?

Thanks in Advance,

Jeff
Viktor Tachev
Telerik team
 answered on 25 Oct 2016
2 answers
64 views

Hello, 

I have a problem where I pull data from a huge database (over 140 000 entries) and have taken care to do my own pagination to limit loading time for my users.  

Basically, on pagination changes (next, prev, click on number etc.) I query my own 20 rows (which is pagesize) to fill up only what the user see and not pull tens of thousands of rows each time which would slow down the user's experience. 

So my problem is, if I do it this way, my table only shows my 20 rows and not whats available to the user. 

 

I have a line in my codebehind that returns the number of results I would like to tell RadGrid is available: 

var querySize = bllUsNet.ObtenirTout().Count;

 

Is there a way to "Trick" Radgrid into thinking there is that many entries but only return 20 ?

 

If anyone has an idea of a better title for this thread, I had a hard time to find one :)

 

Thanks

Rolland
Top achievements
Rank 1
 answered on 25 Oct 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?