Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
147 views
RadFileExplorer:remove the delete and rename option for particular folder

i have one root node name :myfile
    subfolder:PrivateFolder


i want remove the delete and rename option for this private folder only how to achieve this

code :
private void RemoveUploadAndDelete(RadFileExplorer fileExplorer)
    {
        int i;// Global variable for that function


        RadToolBar toolBar = fileExplorer.ToolBar;
        // Remove commands from the ToolBar control;
        i = 0;
        while (i < toolBar.Items.Count)
        {
            if (toolBar.Items[i].Value == "Delete")
            {
                toolBar.Items.RemoveAt(i);
                continue;// Next item
            }

            else if (toolBar.Items[i].Value == "Rename")
            {
                toolBar.Items.RemoveAt(i);
                continue; // Next item
            }

            i++;// Next item
        }

        RadContextMenu treeViewContextMenu = fileExplorer.TreeView.ContextMenus[0];
        // Remove commands from the TreeView's ContextMenus control;

        i = 0;
        while (i < treeViewContextMenu.Items.Count)
        {
            if (treeViewContextMenu.Items[i].Value == "Delete")
            {
                treeViewContextMenu.Items.RemoveAt(i);
                continue;// Next item
            }

            else if (treeViewContextMenu.Items[i].Value == "Rename")
            {
                treeViewContextMenu.Items.RemoveAt(i);
                continue;// Next item
            }

            i++;// Next item
        }


        RadContextMenu gridContextMenu = fileExplorer.GridContextMenu;
        // Remove commands from the GridContextMenu control;

        i = 0;
        while (i < gridContextMenu.Items.Count)
        {
            if (gridContextMenu.Items[i].Value == "Delete")
            {
                gridContextMenu.Items.RemoveAt(i);
                continue;// Next item
            }

            else if (gridContextMenu.Items[i].Value == "Rename")
            {
                gridContextMenu.Items.RemoveAt(i);
                continue;// Next item
            }

            i++;// Next item
        }
    }


But it remove the option all the folder.i want remove the delete and rename option private folder only
 
Vessy
Telerik team
 answered on 29 Oct 2013
3 answers
142 views

this attached example (including radchart, multipage, pageviews) is decent but i found slow loading if the record amount is huge. i d like to modify it like programmatic binding with radGrid fires the DetailTableDataBind event. how can it do? can you show me the example?

Shinu
Top achievements
Rank 2
 answered on 29 Oct 2013
1 answer
818 views
Hi Guys,

I have a radbarcode with output type set to embeddedpng. Can someone help me to access the generated PNG image and save it in a memory stream?

Thanks for all your help,
Dan
Shinu
Top achievements
Rank 2
 answered on 29 Oct 2013
1 answer
117 views
With the following code I have been able to pop-up a Radwindow with the results of my Radgrid populated.  What I would like is for the user to be able to now work with the data within that window.  (Sort, export, filter, etc.)  However whenever I go to do that it closes the window and I have to click the button again to see the filtered results.  Any suggestions on how to get it to stay?

When I have "EnableAJAX" set to false the result RadGrid show properly in the Results Window, however if I set it to "True" then it will not display properly. 

Suggestions on how to get this all to work as I hope it would? 
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server"
    LoadingPanelID="RadAjaxLoadingPanel1" Width="100%" EnableAJAX="True">


<telerik:RadWindowManager ID="RadWindowManager1" runat="server" width="700px" Height="525px" ReloadOnShow="True">
<Windows>
<telerik:RadWindow runat="server" ID="Window"
 
            Behaviors="Move, Resize, Close, Reload"
 
            VisibleStatusbar="false">
 
               <ContentTemplate>
               <telerik:RadGrid ID="_SearchResults" runat="server"
    AllowPaging="True" CellSpacing="0"
    GridLines="None" ShowGroupPanel="True"
    AllowSorting="True" PageSize="25" Width="100%" Height="700px"
    AllowFilteringByColumn="True" OnItemCommand="_SearchResults_ItemCommand">
    <GroupingSettings CaseSensitive="False" />
    <ExportSettings IgnorePaging="True" OpenInNewWindow="True"
        ExportOnlyData="True" FileName="CUCustomSearch">
        <Excel AutoFitImages="True" Format="ExcelML" />
        <Pdf PageHeight="210mm" PageWidth="297mm" DefaultFontFamily="Arial Unicode MS" PageTopMargin="45mm"
            BorderStyle="Medium" BorderColor="#666666">
        </Pdf>
    </ExportSettings>
    <ClientSettings AllowDragToGroup="True" AllowColumnsReorder="True"
        ReorderColumnsOnClient="True">
        <Scrolling AllowScroll="True" UseStaticHeaders="True" />
    </ClientSettings>
    <MasterTableView CommandItemDisplay="Top" InsertItemDisplay="Bottom" TableLayout="Fixed">
    <CommandItemSettings ShowAddNewRecordButton="False"
        ShowExportToCsvButton="False" ShowExportToExcelButton="true" ShowRefreshButton="False" ShowExportToPdfButton="True" />
        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"
            Visible="True">
        </RowIndicatorColumn>
        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"
            Visible="True">
        </ExpandCollapseColumn>
        <EditFormSettings>
            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
            </EditColumn>
        </EditFormSettings>
    </MasterTableView>
    <FilterMenu EnableImageSprites="False">
    </FilterMenu>
</telerik:RadGrid>
</ContentTemplate>
</telerik:RadWindow>
</Windows>
 
 
</telerik:RadWindowManager>
Protected Sub _btnUpdateResults_Click(sender As Object, e As System.EventArgs) Handles _btnUpdateResults.Click
    SetCriteria()
    PopulateDateResults()
    Dim script As String = String.Format("function ShowRadWindow() {{ $find(""{0}"").show(); Sys.Application.remove_load(ShowRadWindow); }} Sys.Application.add_load(ShowRadWindow);", Me.Window.ClientID)
 
    RadScriptManager.RegisterStartupScript(Page, Page.[GetType](), "ShowRadWindow", script, True)
End Sub
Marin Bratanov
Telerik team
 answered on 29 Oct 2013
4 answers
351 views
Hi,

How do i include excel like multi select filter functionality in Radgrid? Same feature is there Silverlight Radgridview but  I can't use silverlight in my application. So if you can provide me with some examples to include multiselect filter functionality in Radgrid similar to Silverlight Radgridview.

Thanks
Shasanka
Princy
Top achievements
Rank 2
 answered on 29 Oct 2013
12 answers
1.3K+ views
Hi ,

I am using RadWindow to open the redirected page . But I'm experiencing the problem, Page URL is showing in the status bar of RadWindow.
Is it possible to hide the URL in the status bar but keep the animated 'Loading' image when the window first opens?

See attached screen shot..

Thanks,
Nawnit
Princy
Top achievements
Rank 2
 answered on 29 Oct 2013
1 answer
118 views

Hai,


               Filter Icon displayed on next line, under filter textbox, for Date Column only.
It looks fine in Firefox and Chrome but in IE filterIcon is displayed on next line under filter text box like in the attachment file.

Please guide me to solve this issue ,

Thanks 

Princy
Top achievements
Rank 2
 answered on 29 Oct 2013
3 answers
207 views
I have a RadTextBox (txtFirstName) that I want to update the label text when the text box has focus:

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Person.aspx.cs" Inherits="IncidentTracking.Person" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">
        function Focus(sender, eventArgs)
        {
            this.txtFirstName.Label = "First Name";
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <telerik:RadTextBox ID="txtFirstName" Runat="server" EmptyMessage="First Name" LabelWidth="64px" Resize="None" Width="160px" TabIndex="1">
        <ClientEvents OnFocus="Focus" />
    </telerik:RadTextBox>
</asp:Content>

However, when I run this code I get:

0x800a138f - Microsoft JScript runtime error: Unable to set value of the property 'Label': object is null or undefined
Shinu
Top achievements
Rank 2
 answered on 29 Oct 2013
1 answer
143 views
Is it possible to provide some custom text in the fake input of asyncupload?

Thanks
Merin
Shinu
Top achievements
Rank 2
 answered on 29 Oct 2013
2 answers
262 views
I have done this before in my other project for previous client but still struggling with it. I have similar code but edit/insert is giving "Cannot insert Null into <fieldName>" error. It works in InPlace but not in webusercontrol. It looks like the value is not getting transferred from WebUserControl form to grid for update. I have attached the code and hope to get someone to point out what am I really missing this time.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Units.aspx.cs"
    Inherits="UMOLWeb.Views.Admin.Units" MasterPageFile="~/TopNav.Master" %>
 
<%@ MasterType VirtualPath="~/TopNav.master" %>
 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphHtmlHeader" runat="server">
    <style type="text/css">
        .EditFormHeader td {
            background: #25A0DA;
            padding: 10px 0px;
        }
 
        .rgRow, .rgAltRow, .rgHeader, .rtlR, .rtlA {
            font-size: small !important;
            padding: 0;
        }
 
        div.RadGrid_MetroTouch .rgHeader, div.RadGrid_MetroTouch th.rgResizeCol {
            padding-top: 0;
            padding-bottom: 0;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphToolbar" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cphContent" runat="server">
 
    <asp:Panel runat="server" Visible="false" ID="pnlContent" Style="height: 100%; margin: 0px">
        <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
            <script type="text/javascript">
                function PopUpShowing(sender, eventArgs) {
                    var myWidth = 0, myHeight = 0;
                    if (typeof (window.innerWidth) == 'number') {
                        //Non-IE
                        myWidth = window.innerWidth;
                        myHeight = window.innerHeight;
 
                    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
                        //IE 6+ in 'standards compliant mode'
                        myWidth = document.documentElement.clientWidth;
                        myHeight = document.documentElement.clientHeight;
                    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
                        //IE 4 compatible
                        myWidth = document.body.clientWidth;
                        myHeight = document.body.clientHeight;
                    }
 
                    popUp = eventArgs.get_popUp();
                    var gridWidth = sender.get_element().offsetWidth;
                    var gridHeight = sender.get_element().offsetHeight;
                    var popUpWidth = popUp.style.width.substr(0, popUp.style.width.indexOf("px"));
                    var popUpHeight = popUp.style.height.substr(0, popUp.style.height.indexOf("px"));
                    popUp.style.left = ((myWidth - popUpWidth) / 2 + sender.get_element().offsetLeft).toString() + "px";
                    var posy = document.body.scrollTop + document.documentElement.scrollTop;
                    popUp.style.top = (posy + sender.get_element().offsetTop + 100).toString() + "px";
                }
 
                function RowDblClick(sender, eventArgs) {
                    sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
                }
            </script>
        </telerik:RadScriptBlock>
 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1"></telerik:AjaxUpdatedControl>
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
         <telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>
        <telerik:RadSplitter ID="RadSplitter1" runat="server" Width="100%" Height="100%"
            HeightOffset="175" Skin="MetroTouch" BorderSize="0">
            <telerik:RadPane ID="RadPane1" runat="server" Scrolling="Y">
                <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="false" BorderWidth="0" AllowAutomaticUpdates="true" AllowAutomaticInserts="true"
                    DataKeyNames="ID" AllowSorting="true" Skin="Windows7" EnableTheming="false" AllowPaging="false" PagerStyle-Mode="NextPrev" PagerStyle-Position="Top" PageSize="12"
                    ShowGroupPanel="True" OnItemUpdated="RadGrid1_ItemUpdated">
                    <MasterTableView DataSourceID="SqlDataSource1" AutoGenerateColumns="False" DataKeyNames="ID"
                        CommandItemDisplay="Top" EditMode="Popup" AllowMultiColumnSorting="true" AllowAutomaticUpdates="true" AllowAutomaticInserts="true">
                        <GroupByExpressions>
                            <telerik:GridGroupByExpression>
                                <SelectFields>
                                    <telerik:GridGroupByField FieldAlias="Region" FieldName="Region"></telerik:GridGroupByField>
                                </SelectFields>
                                <GroupByFields>
                                    <telerik:GridGroupByField FieldName="Region"></telerik:GridGroupByField>
                                </GroupByFields>
                            </telerik:GridGroupByExpression>
                            <telerik:GridGroupByExpression>
                                <SelectFields>
                                    <telerik:GridGroupByField FieldAlias="BusinessUnit" FieldName="BusinessUnit"></telerik:GridGroupByField>
                                </SelectFields>
                                <GroupByFields>
                                    <telerik:GridGroupByField FieldName="BusinessUnit"></telerik:GridGroupByField>
                                </GroupByFields>
                            </telerik:GridGroupByExpression>
                            <telerik:GridGroupByExpression>
                                <SelectFields>
                                    <telerik:GridGroupByField FieldAlias="Area" FieldName="Area"></telerik:GridGroupByField>
                                </SelectFields>
                                <GroupByFields>
                                    <telerik:GridGroupByField FieldName="Area"></telerik:GridGroupByField>
                                </GroupByFields>
                            </telerik:GridGroupByExpression>
                        </GroupByExpressions>
                        <Columns>
                            <telerik:GridEditCommandColumn ButtonType="ImageButton" HeaderText="Edit">
                            </telerik:GridEditCommandColumn>
                            <telerik:GridBoundColumn DataField="UnitNo" HeaderText="Unit" SortExpression="UnitNo"
                                UniqueName="UnitNo">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="UnitType" HeaderText="UnitType" SortExpression="UnitType"
                                UniqueName="UnitType">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="HorsePower" HeaderText="FERCHP" SortExpression="HorsePower"
                                UniqueName="HorsePower">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Engine" HeaderText="Engine" SortExpression="Engine"
                                UniqueName="Engine">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Region" HeaderText="Region" SortExpression="Region"
                                UniqueName="Region">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="BusinessUnit" HeaderText="BU" SortExpression="BusinessUnit"
                                UniqueName="BusinessUnit">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Area" HeaderText="Area" SortExpression="Area"
                                UniqueName="Area">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Station" HeaderText="Station" SortExpression="Station"
                                UniqueName="Station">
                            </telerik:GridBoundColumn>
                            <telerik:GridCheckBoxColumn DataField="IsActive" DataType="System.Boolean" HeaderText="Active" runat="server"></telerik:GridCheckBoxColumn>
                        </Columns>
                        <EditFormSettings CaptionDataField="UnitNo" CaptionFormatString="Edit Information for Unit: {0}"
                            EditFormType="WebUserControl" UserControlName="~/Views/Controls/EditUnitDetails.ascx" InsertCaption="New Unit">
                            <FormTableItemStyle Wrap="False" Width="400px"></FormTableItemStyle>
                            <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle>
                            <FormMainTableStyle GridLines="None" CellSpacing="1" CellPadding="3" />
                            <FormTableStyle CellSpacing="0" CellPadding="2" Height="150px" />
                            <EditColumn ButtonType="ImageButton" InsertText="Insert Location" UpdateText="Update record"
                                UniqueName="EditCommandColumn1" CancelText="Cancel edit">
                            </EditColumn>
                            <FormTableButtonRowStyle HorizontalAlign="Left" CssClass="EditFormButtonRow"></FormTableButtonRowStyle>
                        </EditFormSettings>
                    </MasterTableView>
                    <ClientSettings AllowGroupExpandCollapse="True" AllowDragToGroup="True">
                        <ClientEvents OnPopUpShowing="PopUpShowing" />
                        <ClientEvents OnRowDblClick="RowDblClick" />
                    </ClientSettings>
                    <GroupingSettings ShowUnGroupButton="true"></GroupingSettings>
                </telerik:RadGrid>
            </telerik:RadPane>
        </telerik:RadSplitter>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Windows7">
        </telerik:RadAjaxLoadingPanel>
    </asp:Panel>
    <asp:Panel ID="pnlError" runat="server" Visible="false">
        <table>
            <tr>
                <td style="color: red; font-weight: bold">
                    <asp:Label runat="server" ID="lblError"></asp:Label></td>
            </tr>
        </table>
    </asp:Panel>
 
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:WebAppConnectionString %>"
        SelectCommand="SELECT U.ID,UnitNo, UnitType, EngineType, Model, Manufacturer, HorsePower, CSLocation, UsedforUnitMaintenance, Region, BusinessUnit,Area, Station, CASE WHEN U.[IsActive] =1 THEN 'true' Else 'false' END AS IsActive, LocationId FROM Units U INNER JOIN Location L ON LocationId = L.Id ORDER BY Region, BusinessUnit, Area, Station"
        UpdateCommand="UPDATE Units SET [UnitNo] = @UnitNo, [UnitType] = @UnitType, [EngineType] = @EngineType, [Model] = @Model, [Manufacturer] = @Manufacturer, [HorsePower] = @HorsePower, [CSLocation] = @CSLocation, [UsedforUnitMaintenance] = @UsedforUnitMaintenance, [LocationId] = @LocationId, IsActive=@IsActive WHERE [ID] = @ID">
        <InsertParameters>
            <asp:Parameter Name="UnitNo" Type="String" />
            <asp:Parameter Name="UnitType" Type="String" />
            <asp:Parameter Name="EngineType" Type="String" />
            <asp:Parameter Name="Model" Type="String" />
            <asp:Parameter Name="Manufacturer" Type="String" />
            <asp:Parameter Name="HorsePower" Type="Int32" />
            <asp:Parameter Name="CSLocation" Type="Boolean" />
            <asp:Parameter Name="UsedforUnitMaintenance" Type="Boolean" />
            <asp:Parameter Name="LocationId" Type="Int16"/>
            <asp:Parameter Name="IsActive" Type="Boolean" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="UnitNo" Type="String" />
            <asp:Parameter Name="UnitType" Type="String" />
            <asp:Parameter Name="EngineType" Type="String" />
            <asp:Parameter Name="Model" Type="String" />
            <asp:Parameter Name="Manufacturer" Type="String" />
            <asp:Parameter Name="HorsePower" Type="String" />
            <asp:Parameter Name="CSLocation" Type="Boolean" />
            <asp:Parameter Name="UsedforUnitMaintenance" Type="Boolean" />
            <asp:Parameter Name="LocationId" Type="Int16" />
            <asp:Parameter Name="IsActive" Type="Boolean" />
            <asp:Parameter Name="Id" Type="Int16" />
        </UpdateParameters>
    </asp:SqlDataSource>
</asp:Content>


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using System.Text;
 
namespace UMOLWeb.Views.Admin
{
    public partial class Units : System.Web.UI.Page
    {
        public string PAGE_FUNCTION = "Units Information";
        const string PAGE_DESCRIPTION = "Adit/Edit Location, Unit and Task Information";
 
        private string gridMessage = null;
 
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Roles.IsUserInRole("Manager") && Roles.IsUserInRole("ITSupport"))
            {
                pnlContent.Visible = true;
            }
            else
            {
                lblError.Text = "You are not authorized to view this page";
                pnlError.Visible = true;
            }
        }
 
       
 
        protected void RadGrid1_ItemUpdated(object sender, Telerik.Web.UI.GridUpdatedEventArgs e)
        {
            // Show messages on Update
            if ((e.Exception != null))
            {
                e.ExceptionHandled = true;
                e.KeepInEditMode = true;
                var aMsg = e.Exception.Message.ToString().Split(';');
                SetMessage("<b>Record cannot be updated</b>.<br />Reason:" + String.Format("<span style='color:red'>" + aMsg[0] + "</span>"));
            }
            else
            {
                SetMessage("Record is Updated!");
            }
        }
 
        private void SetMessage(string message)
        {
            gridMessage = message.Replace("'", "\\'").Replace("\n", "<br />");
        }
 
        private void DisplayMessage(string text)
        {
            //Show the error message on the RadWindow
            string msg = "radalert('" + gridMessage + "',500,100);";
            RadAjaxManager1.ResponseScripts.Add(msg);
        }
        #region "Master Page Settings"
 
        protected void Page_PreRender(object sender, System.EventArgs e)
        {
            var _m = Master;
            _m.PageFunction = PAGE_FUNCTION;
            _m.PageDescription = PAGE_DESCRIPTION;
 
            if (!(String.IsNullOrEmpty(gridMessage)))
                DisplayMessage(gridMessage);
        }
 
        #endregion
    }
}

<%@ Control Language="C#" CodeBehind="EditUnitDetails.ascx.cs" Inherits="UMOLWeb.Views.Controls.EditUnitDetails" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<table>
    <tr>
        <td>Location:
        </td>
        <td>
            <telerik:RadComboBox DataTextField="Location" DropDownAutoWidth="Enabled" DataValueField="Id" DataSourceID="sqlDataSrc1"
                 ShowMoreResultsBox="true"  Width="300px" EnableLoadOnDemand="true"
                UniqueName="Location" Filter="Contains" AutoPostBack="true" ID="LocationId"
                ItemsPerRequest="10" runat="server">
 
            </telerik:RadComboBox>
        </td>
    </tr>
    <tr>
        <td>Unit No:
        </td>
        <td>
            <asp:TextBox runat="server" ID="UnitNo" Text='<%# DataBinder.Eval(DataItem, "UnitNo")%>'></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>Unit Type:
        </td>
        <td>
            <asp:TextBox runat="server" ID="UnitType" Text='<%# DataBinder.Eval(DataItem, "UnitType")%>'></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>Engine Type:
        </td>
        <td>
            <asp:TextBox runat="server" ID="EngineType" Text='<%# DataBinder.Eval(DataItem, "EngineType")%>'></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>Manufacturer:
        </td>
        <td>
            <asp:TextBox runat="server" ID="Manufacturer" Text='<%# DataBinder.Eval(DataItem, "Manufacturer")%>'></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>Model:
        </td>
        <td>
            <asp:TextBox runat="server" ID="Model" Text='<%# DataBinder.Eval(DataItem, "Model")%>'></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>HorsePower:
        </td>
        <td>
            <asp:TextBox runat="server" ID="HorsePower" Text='<%# DataBinder.Eval(DataItem, "HorsePower")%>'></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>CS Location:
        </td>
        <td>
            <asp:CheckBox runat="server" ID="CSLocation" Checked='<%# DataBinder.Eval(DataItem, "CSLocation")%>' />
        </td>
    </tr>
    <tr>
        <td>Used for Maintenance:
        </td>
        <td>
            <asp:CheckBox runat="server" ID="UsedforUnitMaintenance" Checked='<%# DataBinder.Eval(DataItem, "UsedforUnitMaintenance")%>' />
        </td>
    </tr>
     <tr>
        <td>Active:
        </td>
        <td>
            <asp:CheckBox runat="server" ID="IsActive" Checked='<%# Convert.ToBoolean(DataBinder.Eval(DataItem, "IsActive"))%>' />
        </td>
    </tr>
 
    <tr>
        <td>
            <div class="Form_Buttons">
                <asp:LinkButton ID="btnSave" runat="server" Text="Save" CommandName="Update" Visible='<%# !(DataItem is Telerik.Web.UI.GridInsertionObject) %>' /> 
                <asp:LinkButton ID="btnAdd" runat="server" Text="Insert" CommandName="PerformInsert"
                    Visible='<%# (DataItem is Telerik.Web.UI.GridInsertionObject) %>' /> 
                <asp:LinkButton ID="btnCancel" runat="server" Text="Cancel" CausesValidation="false"
                    CommandName="Cancel" />
            </div>
        </td>
    </tr>
</table>
<asp:SqlDataSource ID="sqlDataSrc1" runat="server" ConnectionString="<%$ ConnectionStrings:WebAppConnectionString %>"
    SelectCommand="SELECT Region + '-' + BusinessUnit + '-' + Area + '-' + Station AS 'Location', Id FROM [Location]"></asp:SqlDataSource>
<asp:SqlDataSource ID="sqlDataSrc2" runat="server" ConnectionString="<%$ ConnectionStrings:WebAppConnectionString %>"></asp:SqlDataSource>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections.Specialized;
using System.Data;
using Telerik.Web.UI;
using UMOLWeb.Shared;
using UMOLWeb.Models;
 
namespace UMOLWeb.Views.Controls
{
    #region "events"
    public partial class EditUnitDetails : System.Web.UI.UserControl, IBindableControl
    {
        private object _dataItem = null;
 
        public object DataItem
        {
            get{return this._dataItem;}
            set{this._dataItem = value;}
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
             
        }
 
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (!(DataItem is Telerik.Web.UI.GridInsertionObject))
            {
                DataRowView drv = (DataRowView)_dataItem;
 
                if (drv != null)
                {
                    RadComboBoxItem loc = new RadComboBoxItem();
                    loc.Text = drv.Row["Region"].ToString() + "-" + drv.Row["BusinessUnit"].ToString() + "-" + drv.Row["Area"].ToString() + "-" + drv.Row["Station"].ToString();
                    loc.Value = drv.Row["LocationId"].ToString();
                    LocationId.Items.Add(loc);
                    loc.Selected = true;
                    loc.DataBind();
                }
            }
        }
 
       
 
 
        void IBindableControl.ExtractValues(IOrderedDictionary Dictionary)
        {
 
            try
            {
                //retrives all Textbox and add thier values to the dictionary
                foreach (object ctrl in Controls)
                {
                    if ((ctrl is TextBox))
                    {
                        //    //OfType<TextBox>().Select(control => new { FieldName = control.ID, FieldValue = control.Text }))
                        Dictionary.Add(((TextBox)ctrl).ID, ((TextBox)ctrl).Text);
                    }
 
                    if (ctrl is RadComboBox)
                    {
                        Dictionary.Add(((RadComboBox)ctrl).ID, ((RadComboBox)ctrl).SelectedValue);
                    }
 
                    if (ctrl is CheckBox)
                    {
                        Dictionary.Add(((CheckBox)ctrl).ID, ((CheckBox)ctrl).Checked);
                    }
                }
 
            }
            catch (Exception ex)
            {
            }
        }
 
 
    #endregion
}
}


It is not going to extractvalue method at all. 
Vijaianand
Top achievements
Rank 1
 answered on 28 Oct 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?