Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
113 views
is there away in RadGrid that from one row I can set a link to another row that may or may not be on a different page in the grid?

so if on row 1 in the grid with paging set at 20 rows I have a link to the row that may be at row 60 in the datasource, how can I link to that row?
Shinu
Top achievements
Rank 2
 answered on 03 Apr 2009
2 answers
84 views

Hi

I'm using the lastest Q2009 release.

Since I 've updated my project with this release I have a problem with my grid.

I change the rows backcolor in case of a value. (normal, orange or red)

With the latest release the backgroud column with the numeric data stay in white colors.

See a screen here :

http://www.berim.fr/telerik/telerik.htm



Here my code

Protected Sub RadGrid1_ItemDataBound1(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound
        'Is it a GridDataItem
        If (TypeOf (e.Item) Is GridDataItem) Then
            'Get the instance of the right type
            Dim dataBoundItem As GridDataItem = e.Item
            dataBoundItem.ForeColor = Color.Black
            'Check the formatting condition
            If (CType(dataBoundItem("TaillePST").Text, Double) > 1.6) And (CType(dataBoundItem("TaillePST").Text, Double) < 2) Then
                dataBoundItem("TaillePST").Font.Bold = True
                dataBoundItem.BackColor = System.Drawing.ColorTranslator.FromHtml("#fed687")
                'Customize more...
            End If
            If (CType(dataBoundItem("TaillePST").Text, Double) > 2) Then
                dataBoundItem("TaillePST").Font.Bold = True
                dataBoundItem.BackColor = System.Drawing.ColorTranslator.FromHtml("#f8a2a2")
                'Customize more...
            End If
            If (CType(dataBoundItem("TaillePST").Text, Double) = -1) Then
                dataBoundItem("NomPST").ForeColor = Color.Red
                dataBoundItem("NomPST").Font.Bold = True
                'Customize more...
            End If
            If (CType(dataBoundItem("TaillePST").Text, Double) = -2) Then
                dataBoundItem("NomPST").Font.Bold = True
                dataBoundItem.BackColor = System.Drawing.ColorTranslator.FromHtml("#c3f3cd")
                'Customize more...
            End If
        End If
    End Sub


And the grid declation

 

<

 

telerik:RadGrid ID="RadGrid1" runat="server" Style="z-index: 101; left: 8px; position: absolute; top: 200px"

 

 

Width="630px" ForeColor="Black" Skin="Default" GroupingEnabled="False">

 

<

 

MasterTableView CellSpacing="-1">

 

</

 

MasterTableView>

 

<

 

FilterMenu Skin="Gray" EnableTheming="True">

 

<

 

CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>

 

</

 

FilterMenu>

 

 

 

 

 

<StatusBarSettings LoadingText="Chargement..." />

 

 

 

 

 

</telerik:RadGrid>

 

Filleau
Top achievements
Rank 1
 answered on 03 Apr 2009
1 answer
183 views
Hi

I've a RadComboBox in a Gridview Editform. It is filled from a dataclass in the code behind. When I go to edit mode, how do I set the selected value to that in the database.

Andy
Princy
Top achievements
Rank 2
 answered on 03 Apr 2009
1 answer
107 views
Hi All,

I have the following grid declaration bound in the code-behind file:

<radg:radgrid skin="Windows" enableajax="true" onneeddatasource="grdBookingClients_NeedDataSource" 
                gridlines="None" id="grdBookingClients" runat="server" enableajaxloadingtemplate="True" 
                loadingtemplatetransparency="10" showstatusbar="true" autogeneratecolumns="False" 
                ondeletecommand="grdBookingClients_DeleteCommand"
                    <MasterTableView CommandItemDisplay="Top" DataKeyNames="BookingClientID" Name="BookingClient"
                    <Columns> 
 
                        <radG:GridBoundColumn HeaderText="Title" UniqueName="Title" DataField="Title"></radG:GridBoundColumn> 
                        <radG:GridBoundColumn HeaderText="Forename" UniqueName="Forename" DataField="Forename"></radG:GridBoundColumn> 
                        <radG:GridBoundColumn HeaderText="Surname" UniqueName="Surname" DataField="Surname"></radG:GridBoundColumn> 
                         
                        <radG:GridButtonColumn ButtonType="ImageButton" ConfirmText="Are you sure you want to delete this record?" CommandName="Delete" ImageUrl="./images/DataEditing/Delete.gif" Text="Delete" UniqueName="DeleteRecord"
                        </radG:GridButtonColumn> 
                    </Columns> 
                     
                    <ExpandCollapseColumn Resizable="False"
                        <HeaderStyle Width="20px" /> 
                    </ExpandCollapseColumn> 
                    <RowIndicatorColumn Visible="False"
                        <HeaderStyle Width="20px" /> 
                    </RowIndicatorColumn> 
                </MasterTableView> 
                <ExportSettings> 
                    <Pdf PageBottomMargin="" PageFooterMargin="" PageHeaderMargin="" PageHeight="11in" 
                        PageLeftMargin="" PageRightMargin="" PageTopMargin="" PageWidth="8.5in" /> 
                </ExportSettings> 
            </radg:radgrid> 

However, I don't want to be able to refresh the grid or insert a new item. Is there a way of turning these off so the grid is just a series of bound columns with nothing else?

Thanks in advance.
Princy
Top achievements
Rank 2
 answered on 03 Apr 2009
1 answer
150 views
I know this logic can be used to select the first row :

RadGrid1.MasterTableView.Items(0).Selected = True  

 But is there anything like this I can use to select the last one?

Princy
Top achievements
Rank 2
 answered on 03 Apr 2009
1 answer
141 views

Hi,

I have a RadTabStrip with 2 tabs connected to a RadMultipage with 2 pages. On 1 page I have anoth tab with 7 tabs and a grid in another mulitpage. On the second page of the first tab I have a couple of list boxes.

When the tab is selected for the listbox pageview the radwindow is fine. When I return to the pageview containing the grid and other tab the scrollbar appears on the side of the window and I can scroll down about another 1/4 of the window wvwn though nothing is there. Everything fits on th page but by viewing the grid the window thinks there is more.

 

I have set the width and height of the grid to be less than the multipage width and height and everything fits on normally.

I have set the ajaxmanager to: UpdatePanelsRenderMode="Inline".
I have set the grid to: <Scrolling UseStaticHeaders="True" AllowScroll="True"></Scrolling>
I have set the body style to: <body style="overflow:hidden">

I have now run out of tricks....any suggestions?

 

I feel it could be something to do with the actual height of the grid compared to the shown height of the grid with the window thinking that the grid is taller than it is.

 

Regards

Roger

Roger
Top achievements
Rank 1
 answered on 03 Apr 2009
3 answers
264 views
I'm having some issues finding a control nested 2 levels deep.

My primary container is a RadPageView and I need to find a control inside of a Formview nested inside of that. My target is the following control:

<asp:Image ID="NPPhoto" runat="Server" CssClass="detailPhoto" />

I placed my structure in the code snippet section. I have the following code, but it's not working.

Thanks.


Dim imageURL As String
If (UserID = "" Or Not System.IO.File.Exists(Server.MapPath("~/images/profile_images/" & UserID & ".jpg"))) Then
imageURL = "~/images/notavailable.gif"
Else
imageURL = "~/images/profile_images/" + UserID + ".jpg"
End If
Dim Photo As Image = CType(NPProfile.FindControl("NPPhoto"), Image)

        Photo.ImageUrl = imageURL




<telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="3"
            <telerik:RadPageView ID="RadPageView1" runat="server"
                <asp:FormView ID="NPProfile" runat="server"
                    <ItemTemplate> 
                    <div id="Desc_Photo"
                                <asp:Image ID="NPPhoto" runat="Server" CssClass="detailPhoto" /> 
                            </div> 
                        <div class="Desc_Container"

DogEars
Top achievements
Rank 2
 answered on 03 Apr 2009
4 answers
112 views
Not sure what I missed. 
Any help is greatly appreciated. 
I've attempted to code the Custom Advanced Template demo and DBProvider demo all in VB.   Get and Delete Appointments works fine. 
Problems:
1) when I click and drag appointment I get a "must declare variable @UserID (reseource) or @Description (attribute)"
2) when I double-click appointment I get the "There must be equal number of values and descriptions" CreateListItemArray alert message
3) when I double-click on schedule to create a new appointment I get same alert as #2
Thanks
John
Matt
Top achievements
Rank 2
 answered on 03 Apr 2009
0 answers
73 views
Hi guys:

We're using a sliding panelbar like the one in this online demo to display help information within an intranet application.

http://demos.telerik.com/aspnet-ajax/panelbar/examples/applicationscenarios/slidingpanelbar/defaultcs.aspx

The help is context sensitive to each page, and we're writing the contents of the panels at page load.  We'd really like to enhance the interface by adding hyperlinks (or buttons of some sort) next to the actual page elements that have help available.  We'd like the user to be able to click on these links and have the panelbar automatically slide out with the relevant panel active.

Is there an easy way to make this happen?  Does anyone have an example?

Thanks,

Brad
Brad
Top achievements
Rank 1
 asked on 02 Apr 2009
1 answer
111 views
Hi Everyone,

I have two grids, one on the right and one on the left and I've implemented drag and drop functionality.  The actual dragging and dropping works fine, however, the initial data that is loaded into the "Available" grid isn't correct.  Instead of the values that are returned from my dataset, I'm receiving [ProjectName].[PageName]+Field listed in each row of the table (screenshot of the page: http://img164.imageshack.us/img164/1317/screenshotg.jpg)

My code is below, any help is greatly appreciated.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MaintenanceConsists.aspx.cs" Inherits="Web.MaintenanceConsists" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title></title
<style type="text/css"
html, body, form 
    height: 100%; 
    padding: 0px; 
    margin: 0px; 
    overflow: hidden; 
</style> 
 
<telerik:RadScriptBlock runat="server" ID="scriptBlock"
 
<script type="text/javascript"
function onRowDropping(sender, args) 
    if (sender.get_id() == "<%=uxRadGridAvailable.ClientID %>") 
    { 
        var node = args.get_destinationHtmlElement(); 
        if(!isChildOf('<%=uxRadGridSelected.ClientID %>', node) && !isChildOf('<%=uxRadGridAvailable.ClientID %>', node) ) 
        { 
            args.set_cancel(true); 
        } 
    } 
    if (sender.get_id() == "<%=uxRadGridSelected.ClientID %>") 
    { 
        var node = args.get_destinationHtmlElement(); 
        if(!isChildOf('<%=uxRadGridAvailable.ClientID %>', node) && !isChildOf('<%=uxRadGridSelected.ClientID %>', node) ) 
        { 
            args.set_cancel(true); 
        } 
    } 
 
function isChildOf(parentId, element) 
    while(element) 
    { 
        if (element.id && element.id.indexOf(parentId) > -1) 
        { 
            return true; 
        } 
        elementelement = element.parentNode; 
    } 
    return false; 
 
function centerUpdatePanel() 
    centerElementOnScreen(document.getElementById("uxRadAjaxLoadingPanel")); 
 
function centerElementOnScreen(element) 
    var scrollTop = document.body.scrollTop; 
    var scrollLeft = document.body.scrollLeft; 
    var viewPortHeight = document.body.clientHeight; 
    var viewPortWidth = document.body.clientWidth; 
    if (document.compatMode == "CSS1Compat") 
    { 
     viewPortHeight = document.documentElement.clientHeight; 
     viewPortWidth = document.documentElement.clientWidth; 
     scrollTop = document.documentElement.scrollTop; 
     scrollLeft = document.documentElement.scrollLeft; 
    } 
    var topOffset = Math.ceil(viewPortHeight/2 - element.offsetHeight/2); 
    var leftOffset = Math.ceil(viewPortWidth/2 - element.offsetWidth/2); 
    var top = scrollTop + topOffset - 40; 
    var left = scrollLeft + leftOffset - 70; 
       element.style.position = "absolute"
    element.style.top = top + "px"; 
    element.style.left = left + "px"; 
</script> 
 
</telerik:RadScriptBlock> 
         
</head> 
<body> 
    <form id="form1" runat="server"
    <asp:ScriptManager id="ScriptManager" runat="server" /> 
     <telerik:RadAjaxLoadingPanel IsSticky="true" ID="uxRadAjaxLoadingPanel" runat="server" 
        Height="75px" Width="75px"
        <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading1.gif") %>' 
            style="border: 0px;" /> 
    </telerik:RadAjaxLoadingPanel> 
    <telerik:RadAjaxManager runat="server" ID="uxRadAjaxManager"
        <ClientEvents OnRequestStart="centerUpdatePanel();"></ClientEvents> 
        <ajaxsettings> 
            <telerik:AjaxSetting AjaxControlID="uxRadGridAvailable"
                <updatedcontrols> 
                    <telerik:AjaxUpdatedControl ControlID="uxRadGridAvailable" LoadingPanelID="uxRadAjaxLoadingPanel" /> 
                    <telerik:AjaxUpdatedControl ControlID="uxRadGridSelected" LoadingPanelID="uxRadAjaxLoadingPanel" /> 
                </updatedcontrols> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="uxRadGridSelected"
                <updatedcontrols> 
                    <telerik:AjaxUpdatedControl ControlID="uxRadGridAvailable" LoadingPanelID="uxRadAjaxLoadingPanel" /> 
                    <telerik:AjaxUpdatedControl ControlID="uxRadGridSelected" LoadingPanelID="uxRadAjaxLoadingPanel" /> 
                </updatedcontrols> 
            </telerik:AjaxSetting> 
        </ajaxsettings> 
    </telerik:RadAjaxManager> 
    <telerik:RadSplitter ID="uxRadSplitter" runat="server" Width="100%"  
        Height="100%" Orientation="Horizontal" BorderSize="0" BorderStyle="None" Skin="Web20"
        <telerik:RadPane ID="uxRadPaneHeader" runat="server" Height="100px"
            Header Pane 
        </telerik:RadPane> 
        <telerik:RadSplitBar ID="uxRadSplitBarHeader" runat="server" CollapseMode="Forward" /> 
        <telerik:RadPane ID="uxRadPaneDetail" runat="server" Scrolling="None"
            <telerik:RadSplitter ID="uxRadSplitterDetail" runat="server" Skin="Web20"
                <telerik:RadPane ID="uxRadePaneLeft" runat="server"
                <telerik:RadGrid runat="server" ID="uxRadGridAvailable" Skin="WebBlue" OnNeedDataSource="uxRadGridAvailable_NeedDataSource"  
                    AllowMultiRowSelection="True" AutoGenerateColumns="False"  
                        OnRowDrop="uxRadGridAvailable_RowDrop" GridLines="None" Height="100%"  
                        Width="100%" BorderStyle="None" AllowPaging="True" PageSize="50" >   
                    <MasterTableView DataKeyNames="assetID" TableLayout="Fixed"  
                        Caption="Equipment">   
                        <RowIndicatorColumn> 
                            <HeaderStyle Width="20px" /> 
                        </RowIndicatorColumn> 
                        <ExpandCollapseColumn> 
                            <HeaderStyle Width="20px" /> 
                        </ExpandCollapseColumn> 
                        <Columns>  
                            <telerik:GridBoundColumn HeaderText="Equipment ID" UniqueName="column"></telerik:GridBoundColumn>  
                            <telerik:GridBoundColumn HeaderText="Category" UniqueName="column"></telerik:GridBoundColumn>  
                            <telerik:GridBoundColumn HeaderText="Type" UniqueName="column"></telerik:GridBoundColumn>  
                        </Columns>  
                    </MasterTableView>  
                    <ClientSettings AllowRowsDragDrop="True">   
                        <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" />  
                        <ClientEvents OnRowDropping="onRowDropping" />  
                        <Scrolling AllowScroll="true" UseStaticHeaders="true" />  
                    </ClientSettings>  
                    <HeaderContextMenu EnableTheming="True" Skin="Office2007"
                        <CollapseAnimation Duration="200" Type="OutQuint" /> 
                    </HeaderContextMenu> 
                    <PagerStyle Mode="NextPrevAndNumeric" />  
                    <FilterMenu EnableTheming="True" Skin="Office2007"
                        <CollapseAnimation Duration="200" Type="OutQuint" /> 
                    </FilterMenu> 
                </telerik:RadGrid>  
                </telerik:RadPane> 
                <telerik:RadSplitBar ID="uxRadSplitBarDetail" runat="server" /> 
                <telerik:RadPane ID="uxRadPaneRight" runat="server"
                <telerik:RadGrid runat="server" ID="uxRadGridSelected" Skin="WebBlue" OnNeedDataSource="uxRadGridSelected_NeedDataSource"  
                    Width="100%" AllowMultiRowSelection="True" AutoGenerateColumns="False"  
                        OnRowDrop="uxRadGridSelected_RowDrop" GridLines="None" BorderStyle="None"  
                        Height="100%">   
                    <HeaderContextMenu EnableTheming="True" Skin="Office2007"
                        <CollapseAnimation Duration="200" Type="OutQuint" /> 
                    </HeaderContextMenu> 
                   <MasterTableView DataKeyNames="assetID" TableLayout="Fixed"  
                        Caption="Positions">    
                        <RowIndicatorColumn> 
                            <HeaderStyle Width="20px" /> 
                        </RowIndicatorColumn> 
                        <ExpandCollapseColumn> 
                            <HeaderStyle Width="20px" /> 
                        </ExpandCollapseColumn> 
                        <Columns>  
                            <telerik:GridBoundColumn HeaderText="Equipment ID"></telerik:GridBoundColumn>  
                            <telerik:GridBoundColumn HeaderText="Category"></telerik:GridBoundColumn>  
                            <telerik:GridBoundColumn HeaderText="Type"></telerik:GridBoundColumn>  
                        </Columns>  
                    </MasterTableView>  
                    <ClientSettings AllowRowsDragDrop="True">   
                        <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" />  
                        <ClientEvents OnRowDropping="onRowDropping" />  
                        <Scrolling AllowScroll="True" UseStaticHeaders="True" /> 
                    </ClientSettings>  
                    <FilterMenu EnableTheming="True" Skin="Office2007"
                        <CollapseAnimation Duration="200" Type="OutQuint" /> 
                    </FilterMenu> 
                </telerik:RadGrid>  
                </telerik:RadPane> 
            </telerik:RadSplitter> 
        </telerik:RadPane> 
        <telerik:RadSplitBar ID="RadSplitBarFooter" runat="server"  
            CollapseMode="Backward" /> 
        <telerik:RadPane ID="RadPaneFooter" runat="server" Height="50px"
            Footer Pane 
        </telerik:RadPane> 
    </telerik:RadSplitter> 
    </form> 
</body> 
</html> 
 

using System; 
using TRMS.Utilities; 
using System.Data; 
using Telerik.Web.UI; 
using System.Web.UI.WebControls; 
using System.Collections.Generic; 
using TRMS.BLL; 
 
namespace Web 
    public partial class MaintenanceConsists : System.Web.UI.Page 
    { 
        #region GlobalVariables 
        string TableName = ""
        string Fields = ""
        #endregion 
        #region Events 
        protected void Page_Load(object sender, EventArgs e) 
        { 
            GetQueryString(); 
        } 
 
        protected void uxRadGridAvailable_NeedDataSource(object source, GridNeedDataSourceEventArgs e) 
        { 
            uxRadGridAvailable.DataSource = AvailableFields; 
        } 
        protected void uxRadGridSelected_NeedDataSource(object source, GridNeedDataSourceEventArgs e) 
        { 
            uxRadGridSelected.DataSource = SelectedFields; 
        } 
 
        protected void uxRadGridAvailable_RowDrop(object sender, GridDragDropEventArgs e) 
        { 
            DropRowAvailableGrid(e); 
        } 
 
        protected void uxRadGridSelected_RowDrop(object sender, GridDragDropEventArgs e) 
        { 
            DropRowSelectedGrid(e); 
        } 
        #endregion 
        #region Methods 
        private void GetQueryString() 
        { 
            TableName = Request.QueryString.Get("Table"); 
            Fields = Request.QueryString.Get("Fields"); 
        } 
 
        protected IList<Field> AvailableFields 
        { 
            get 
            { 
                try 
                { 
                    object obj = Session["AvailableFields"]; 
                    if (obj == null
                    { 
                        obj = GetAvailableFields(); 
                        if (obj != null
                        { 
                            Session["AvailableFields"] = obj; 
                        } 
                        else 
                        { 
                            obj = new List<Field>(); 
                        } 
                    } 
                    return (IList<Field>)obj; 
                } 
                catch 
                { 
                    Session["AvailableFields"] = null
                } 
                return new List<Field>(); 
            } 
            set { Session["AvailableFields"] = value; } 
        } 
 
        protected IList<Field> SelectedFields 
        { 
            get 
            { 
                try 
                { 
                    object obj = Session["SelectedFields"]; 
                    if (obj == null
                    { 
                        Session["SelectedFields"] = obj = new List<Field>(); 
                    } 
                    return (IList<Field>)obj; 
                } 
                catch 
                { 
                    Session["SelectedFields"] = null
                } 
                return new List<Field>(); 
            } 
            set { Session["SelectedFields"] = value; } 
        } 
 
        protected IList<Field> GetAvailableFields() 
        { 
            string AssetID = ""
            string Category = ""
            string AssetType = ""
 
            IList<Field> results = new List<Field>(); 
            if (!StringUtility.IsNullOrEmptyString(TableName) && !StringUtility.IsNullOrEmptyString(Fields)) 
            { 
                DataSet availableDataSet = MaintenanceConsistsBLLC.GetEquipmentAndTypes(TableName, Fields); 
                if (availableDataSet != null
                { 
                    foreach (DataRow dataRow in availableDataSet.Tables[0].Rows) 
                    { 
                        AssetID = dataRow["AssetID"].ToString(); 
                        Category = dataRow["Category"].ToString(); 
                        AssetType = dataRow["AssetType"].ToString(); 
                        results.Add(new Field(AssetID, Category, AssetType)); 
                    }                      
                } 
            } 
            else 
            { 
                results = null
            } 
 
            return results; 
        } 
 
        private void DropRowAvailableGrid(GridDragDropEventArgs e) 
        { 
            if (string.IsNullOrEmpty(e.HtmlElement)) 
            { 
                if (e.DraggedItems[0].OwnerGridID == uxRadGridAvailable.ClientID) 
                { 
                    // items are drag from available to selected grid   
                    if ((e.DestDataItem == null && SelectedFields.Count == 0) || 
                        e.DestDataItem != null && e.DestDataItem.OwnerGridID == uxRadGridSelected.ClientID) 
                    { 
                        IList<Field> selectedFields = SelectedFields; 
                        IList<Field> availableFields = AvailableFields; 
                        foreach (GridDataItem draggedItem in e.DraggedItems) 
                        { 
                            Field tmpField = GetField(availableFields, (string)draggedItem.GetDataKeyValue("assetID")); 
                            if (tmpField != null
                            { 
                                selectedFields.Add(tmpField); 
                                availableFields.Remove(tmpField); 
                            } 
                        } 
                        SelectedFields = selectedFields; 
                        AvailableFields = availableFields; 
                        uxRadGridAvailable.Rebind(); 
                        uxRadGridSelected.Rebind(); 
                    } 
                    else if (e.DestDataItem != null && e.DestDataItem.OwnerGridID == uxRadGridAvailable.ClientID) 
                    { 
                        //reorder items in available  grid   
                        IList<Field> availableFields = AvailableFields; 
                        Field field = GetField(availableFields, (string)e.DestDataItem.GetDataKeyValue("assetID")); 
                        int destinationIndex = availableFields.IndexOf(field); 
                        List<Field> fieldsToMove = new List<Field>(); 
                        foreach (GridDataItem draggedItem in e.DraggedItems) 
                        { 
                            Field tmpField = GetField(availableFields, (string)draggedItem.GetDataKeyValue("assetID")); 
                            if (tmpField != null
                                fieldsToMove.Add(tmpField); 
                        } 
                        foreach (Field fieldToMove in fieldsToMove) 
                        { 
                            availableFields.Remove(fieldToMove); 
                            availableFields.Insert(destinationIndex, fieldToMove); 
                        } 
                        AvailableFields = availableFields; 
                        uxRadGridAvailable.Rebind(); 
                        e.DestDataItem.Selected = true
                    } 
                } 
            } 
        } 
 
        private void DropRowSelectedGrid(GridDragDropEventArgs e) 
        { 
            if (string.IsNullOrEmpty(e.HtmlElement)) 
            { 
                if (e.DraggedItems[0].OwnerGridID == uxRadGridSelected.ClientID) 
                { 
                    // items are drag from selected to available grid   
                    if ((e.DestDataItem == null && AvailableFields.Count == 0) || 
                        e.DestDataItem != null && e.DestDataItem.OwnerGridID == uxRadGridAvailable.ClientID) 
                    { 
                        IList<Field> availableFields = AvailableFields; 
                        IList<Field> selectedFields = SelectedFields; 
                        foreach (GridDataItem draggedItem in e.DraggedItems) 
                        { 
                            Field tmpField = GetField(selectedFields, (string)draggedItem.GetDataKeyValue("assetID")); 
                            if (tmpField != null
                            { 
                                availableFields.Add(tmpField); 
                                selectedFields.Remove(tmpField); 
                            } 
                        } 
                        AvailableFields = availableFields; 
                        SelectedFields = selectedFields; 
                        uxRadGridSelected.Rebind(); 
                        uxRadGridAvailable.Rebind(); 
                    } 
                    else if (e.DestDataItem != null && e.DestDataItem.OwnerGridID == uxRadGridSelected.ClientID) 
                    { 
                        //reorder items in selected  grid   
                        IList<Field> selectedFields = SelectedFields; 
                        Field field = GetField(selectedFields, (string)e.DestDataItem.GetDataKeyValue("assetID")); 
                        int destinationIndex = selectedFields.IndexOf(field); 
                        List<Field> fieldsToMove = new List<Field>(); 
                        foreach (GridDataItem draggedItem in e.DraggedItems) 
                        { 
                            Field tmpField = GetField(selectedFields, (string)draggedItem.GetDataKeyValue("assetID")); 
                            if (tmpField != null
                                fieldsToMove.Add(tmpField); 
                        } 
                        foreach (Field fieldToMove in fieldsToMove) 
                        { 
                            selectedFields.Remove(fieldToMove); 
                            selectedFields.Insert(destinationIndex, fieldToMove); 
                        } 
                        AvailableFields = selectedFields; 
                        uxRadGridSelected.Rebind(); 
                        e.DestDataItem.Selected = true
                    } 
                } 
            } 
        } 
 
        private static Field GetField(IEnumerable<Field> fieldsToSearchIn, string fieldName) 
        { 
            foreach (Field field in fieldsToSearchIn) 
            { 
                if (field.assetID == fieldName) 
                { 
                    return field; 
                } 
            } 
            return null
        } 
        #endregion 
        #region Nested type: Field 
        protected class Field 
        { 
            private string _assetID; 
            private string _category; 
            private string _type; 
            public Field(string assetID, string category, string type) 
            { 
                _assetID = assetID; 
                _category = category; 
                _type = type; 
            } 
            public string assetID 
            { 
                get { return _assetID; } 
            } 
            public string category 
            { 
                get { return _category; } 
            } 
            public string type 
            { 
                get { return _type; } 
            } 
        } 
        #endregion   
  
    } 

Bailey Everitt
Top achievements
Rank 1
 answered on 02 Apr 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?