Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
332 views
I have a form with multiple RadComboBoxes in it.  There are populated by the NeedsDataSource option.  The grid is being edited using InLine batch updating.  When the item is saved, the hash values are missing for the combobox fields unless I have opened them once while editing the record.  It seems I need to have the all populate.  How can I do that?

ASPX
<%@ Page Title="" Language="C#"  MasterPageFile="~/Content/themes/Level_One.Master" AutoEventWireup="true" CodeBehind="RequestGridView.aspx.cs" Inherits="WebApplication.Forms.RequestGridView" %>
 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ MasterType VirtualPath="~/Content/themes/Level_One.Master" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="../Content/Styles.css" rel="Stylesheet" />
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            var radGridId = "<%=requests_grid.ClientID %>";
        </script>
    </telerik:RadCodeBlock>
    <%: System.Web.Optimization.Styles.Render("~/Content/css") %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="main_placeholder" runat="server">
    <style type="text/css">
        html body span .rinSingle .riTextBox RadInput .RadInput_Default
        {
            width: 100% !important;
        }
 
    </style>
   <telerik:RadCodeBlock ID="cb1" runat="server">
        <script type="text/javascript">
            function mngRequestStarted(ajaxManager, eventArgs) {
                // alert(eventArgs.get_eventTargetElement())
                var newArr = new Array();
                for (var name in ajaxManager) {
                    newArr.push(name + "<-->" + ajaxManager[name])
 
                }
            }
 
        </script>
    </telerik:RadCodeBlock>
 
    <telerik:RadScriptManager ID="main_radscriptmanager" runat="server" EnableViewState="true">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </telerik:RadScriptManager>
    <telerik:RadAjaxLoadingPanel ID="main_loading" runat="server" Skin="Metro" EnableViewState="true"></telerik:RadAjaxLoadingPanel>
    <telerik:RadScriptBlock runat="server" ID="RadScriptBlock2">
<%--        <script type="text/javascript">
 
            function RowContextMenu(sender, eventArgs) {
                var menu = $find("<%=RadMenu1.ClientID %>");
                var evt = eventArgs.get_domEvent();
                var index = eventArgs.get_gridDataItem().get_element().id.split("__")[1];
                document.getElementById("<%=radGridClickedRowIndex.ClientID %>").value = index;
                sender.get_masterTableView().selectItem(sender.get_masterTableView().get_dataItems()[index].get_element(), true);
                menu.show(evt);
                evt.cancelBubble = true;
                evt.returnValue = false;
                if (evt.stopPropagation) {
                    evt.stopPropagation();
                    evt.preventDefault();
                }
            }
        </script>--%>
    </telerik:RadScriptBlock>
    <%--<asp:HiddenField ID="radGridClickedRowIndex" runat="server" />--%>
 
    <telerik:RadAjaxManager ID="main_ajaxmanager" runat="server" EnableAJAX="true" EnableViewState="true" ClientEvents-OnRequestStart="mngRequestStarted">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="requests_grid">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="requests_grid" LoadingPanelID="main_loading" />
                    <telerik:AjaxUpdatedControl ControlID="requests_grid" UpdatePanelHeight="100%" />
                </UpdatedControls>
            </telerik:AjaxSetting>
 
            <telerik:AjaxSetting AjaxControlID="main_windowmanager">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="main_windowmanager" LoadingPanelID="main_loading" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
 
    <telerik:RadGrid ID="requests_grid" runat="server"
        Height="100%"
        Skin="Metro"
        EnableViewState="true"
        AutoGenerateColumns="false"
        ShowFooter="false"
        AllowSorting="true"
        CommandItemDisplay="Top"
        AllowFilteringByColumn="False"
        AllowAutomaticUpdates="True"
        OnNeedDataSource="requests_grid_NeedDataSource"
        OnBatchEditCommand="requests_grid_BatchEditCommand"
        OnItemCommand="requests_grid_ItemCommand"
        OnItemDataBound="requests_grid_ItemDataBound">
        <MasterTableView AutoGenerateColumns="false" DataKeyNames="RequestId" CommandItemDisplay="Top" EditMode="Batch">
            <BatchEditingSettings EditType="Row" OpenEditingEvent="Click" />
            <ColumnGroups>
                <telerik:GridColumnGroup HeaderText="Estimates" Name="Estimates" HeaderStyle-HorizontalAlign="Center"></telerik:GridColumnGroup>
                <telerik:GridColumnGroup HeaderText="Actuals" Name="Actuals" HeaderStyle-HorizontalAlign="Center"></telerik:GridColumnGroup>
                <telerik:GridColumnGroup HeaderText="Function Owner" Name="FunctionOwner" HeaderStyle-HorizontalAlign="Center"></telerik:GridColumnGroup>
            </ColumnGroups>
            <Columns>
                <telerik:GridBoundColumn DataField="RequestId"
                    HeaderText="ID"
                    HeaderStyle-Width="50px"
                    ReadOnly="true">
                    <ItemStyle HorizontalAlign="Center" />
                </telerik:GridBoundColumn>
                <%--<telerik:GridBoundColumn DataField="RequestTitle"
                    HeaderStyle-Width="250px"
                    HeaderText="Request Title"
                    UniqueName="RequestTitle">
                    <ItemStyle Width="100%" />
                </telerik:GridBoundColumn>--%>
                <telerik:GridTemplateColumn HeaderText="Request Title"
                    HeaderStyle-Width="250px"
                    UniqueName="RequestTitle"
                    DataField="RequestTitle">
                    <ItemTemplate>
                        <%# Eval("RequestTitle") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadTextBox runat="server"
                            ID="txtRequestTitle" Width="100%" TextMode="MultiLine" Rows="3" Wrap="true">
                        </telerik:RadTextBox>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Function Tool"
                    HeaderStyle-Width="200px"
                    UniqueName="FunctionToolId"
                    DataField="FunctionToolId">
                    <ItemTemplate>
                        <%# Eval("FunctionFunctionToolName") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadComboBox runat="server" ID="cboFunctionTool"
                            EnableLoadOnDemand="true"
                            Width="100%"
                            MarkFirstMatch="true"
                            OnItemsRequested="cboFunctionTool_ItemsRequested">
                        </telerik:RadComboBox>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Category"
                    HeaderStyle-Width="100px"
                    UniqueName="RequestTypeId"
                    DataField="RequestTypeId">
                    <ItemTemplate>
                        <%# Eval("RequestTypeName") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadComboBox runat="server" ID="cboRequestType"
                            EnableLoadOnDemand="true"
                            Width="100%"
                            MarkFirstMatch="true"
                            OnItemsRequested="cboRequestType_ItemsRequested">
                        </telerik:RadComboBox>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Priority"
                    HeaderStyle-Width="100px"
                    UniqueName="PriorityId"
                    DataField="PriorityId">
                    <ItemTemplate>
                        <%# Eval("PriorityName") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadComboBox runat="server" ID="cboPriority"
                            EnableLoadOnDemand="true"
                            Width="100%"
                            MarkFirstMatch="true"
                            OnItemsRequested="cboPriority_ItemsRequested">
                        </telerik:RadComboBox>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Status"
                    HeaderStyle-Width="200px"
                    UniqueName="RequestStatusId"
                    DataField="RequestStatusId">
                    <ItemTemplate>
                        <%# Eval("RequestStatus") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadComboBox runat="server" ID="cboStatus"
                            EnableLoadOnDemand="true"
                            Width="100%"
                            MarkFirstMatch="true"
                            OnItemsRequested="cboStatus_ItemsRequested">
                        </telerik:RadComboBox>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Assigned To"
                    HeaderStyle-Width="200px"
                    UniqueName="AssignedTo"
                    DataField="AssignedTo">
                    <ItemTemplate>
                        <%# Eval("Assignee") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadComboBox runat="server" ID="cboAssignedTo"
                            EnableLoadOnDemand="true"
                            Width="100%"
                            MarkFirstMatch="true"
                            OnItemsRequested="cboAssignedTo_ItemsRequested">
                        </telerik:RadComboBox>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Requested By"
                    HeaderStyle-Width="200px"
                    UniqueName="RequestedBy"
                    DataField="RequestedBy">
                    <ItemTemplate>
                        <%# Eval("RequestedByName") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadComboBox runat="server" ID="cboRequestedBy"
                            EnableLoadOnDemand="true"
                            Width="100%"
                            MarkFirstMatch="true"
                            OnItemsRequested="cboRequestedBy_ItemsRequested">
                        </telerik:RadComboBox>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Division"
                    HeaderStyle-Width="200px"
                    UniqueName="DivisionId"
                    DataField="DivisionId">
                    <ItemTemplate>
                        <%# Eval("DivisionName") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadComboBox runat="server" ID="cboDivision"
                            EnableLoadOnDemand="true"
                            Width="100%"
                            MarkFirstMatch="true"
                            OnItemsRequested="cboDivision_ItemsRequested">
                        </telerik:RadComboBox>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Sequence"
                    HeaderStyle-Width="90px"
                    UniqueName="Sequence"
                    DataField="Sequence">
                    <ItemTemplate>
                        <%# Eval("Sequence") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadNumericTextBox ID="Sequence" runat="server" Type="Number"
                            EnabledStyle-HorizontalAlign="Right"
                            Width="100%">
                            <NumberFormat DecimalDigits="0" />
                        </telerik:RadNumericTextBox>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Site"
                    HeaderStyle-Width="200px"
                    UniqueName="SiteId"
                    DataField="SiteId">
                    <ItemTemplate>
                        <%# Eval("SiteName") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadComboBox runat="server" ID="cboSite"
                            EnableLoadOnDemand="true"
                            Width="100%"
                            MarkFirstMatch="true"
                            OnItemsRequested="cboSite_ItemsRequested">
                        </telerik:RadComboBox>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="New Comment"
                    HeaderStyle-Width="250px"
                    UniqueName="Comments">
                    <ItemTemplate>
                         
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadTextBox runat="server"
                            ID="txtNewComment" Width="100%" TextMode="MultiLine" Rows="3" Wrap="true">
                        </telerik:RadTextBox>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Start Date"
                    HeaderStyle-Width="100px"
                    UniqueName="EstimatedStartDate"
                    DataField="EstimatedStartDate"
                    ColumnGroupName="Estimates">
                    <ItemTemplate>
                        <%# Eval("EstimatedStartDate", "{mm/dd/yy}") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadDatePicker ID="dpEstimatedStartDate" runat="server"
                            Width="100%">
                        </telerik:RadDatePicker>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Completion Date"
                    HeaderStyle-Width="100px"
                    UniqueName="EstimatedCompletionDate"
                    DataField="EstimatedCompletionDate"
                    ColumnGroupName="Estimates">
                    <ItemTemplate>
                        <%# Eval("EstimatedStartDate", "{mm/dd/yy}") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadDatePicker ID="dpEstimatedCompletionDate" runat="server"
                            Width="100%">
                        </telerik:RadDatePicker>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Hours"
                    HeaderStyle-Width="90px"
                    UniqueName="EstimatedHours"
                    DataField="EstimatedHours"
                    ColumnGroupName="Estimates">
                    <ItemStyle HorizontalAlign="Right" />
                    <ItemTemplate>
                        <%# Eval("EstimatedHours") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadNumericTextBox ID="txtEstimatedHours" runat="server"
                            Width="100%"
                            EnabledStyle-HorizontalAlign="Right">
                            <NumberFormat DecimalDigits="2" />
                        </telerik:RadNumericTextBox>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Start Date"
                    HeaderStyle-Width="100px"
                    UniqueName="ActualStartDate"
                    DataField="ActualStartDate"
                    ColumnGroupName="Actuals">
                    <ItemTemplate>
                        <%# Eval("ActualStartDate", "{mm/dd/yy}") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadDatePicker ID="dpActualStartDate" runat="server"
                            Width="100%">
                        </telerik:RadDatePicker>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Hours"
                    HeaderStyle-Width="90px"
                    UniqueName="ActualHours"
                    DataField="ActualHours"
                    ColumnGroupName="Actuals">
                    <ItemStyle HorizontalAlign="Right" />
                    <ItemTemplate>
                        <%# Eval("ActualHours") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadNumericTextBox ID="txtActualHours" runat="server"
                            Width="100%"
                            EnabledStyle-HorizontalAlign="Right">
                            <NumberFormat DecimalDigits="2" />
                        </telerik:RadNumericTextBox>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Date Closed"
                    HeaderStyle-Width="100px"
                    UniqueName="ClosingDate"
                    DataField="ClosingDate"
                    ColumnGroupName="Actuals">
                    <ItemTemplate>
                        <%# Eval("ClosingDate", "{mm/dd/yy}") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadDatePicker ID="dpClosingDate" runat="server"
                            Width="100%">
                        </telerik:RadDatePicker>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Fixed Costs"
                    HeaderStyle-Width="90px"
                    UniqueName="FixedCosts"
                    DataField="FixedCosts">
                    <ItemTemplate>
                        <%# Eval("FixedCosts") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadNumericTextBox ID="txtFixedCosts" runat="server"
                            EnabledStyle-HorizontalAlign="Right"
                            Type="Number"
                            Width="100%">
                            <NumberFormat DecimalDigits="0" />
                        </telerik:RadNumericTextBox>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="CreatedOn"
                    HeaderText="Created"
                    DataFormatString="{0:d}"
                    HeaderStyle-Width="100px"
                    HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-HorizontalAlign="Right"
                    ReadOnly="true">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="CreatedByName"
                    HeaderText="Created By"
                    HeaderStyle-Width="120px"
                    ReadOnly="true">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="UpdatedOn"
                    HeaderText="Updated"
                    DataFormatString="{0:d}"
                    HeaderStyle-Width="100px"
                    HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-HorizontalAlign="Right"
                    ReadOnly="true">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="UpdatedByName"
                    HeaderText="Updated By"
                    HeaderStyle-Width="120px"
                    ReadOnly="true">
                </telerik:GridBoundColumn>
 
            </Columns>
        </MasterTableView>
        <ClientSettings AllowColumnsReorder="true" AllowKeyboardNavigation="true">
            <Scrolling AllowScroll="true" UseStaticHeaders="true" FrozenColumnsCount="1" />
        </ClientSettings>
    </telerik:RadGrid>
 
    <telerik:RadWindowManager runat="server" ID="main_windowmanager" EnableViewState="true"></telerik:RadWindowManager>
 
</asp:Content>


C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Core;
using DataEntities.Application.Context;
using DataEntities.Application.Entities;
using Telerik.Web.UI;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
 
 
namespace Jabil.WebApplication.Forms
{
    public partial class RequestGridView : FrameworkPage
    {
 
        private class FilterOptions
        {
            int _FunctionId = -1;
            int _FunctionToolId = -1;
            bool _Closed = false;
 
            public int FunctionId
            {
                get
                { return _FunctionId; }
                set
                { _FunctionId = value; }
            }
            public int FunctionToolId
            {
                get
                { return _FunctionToolId; }
                set
                { _FunctionToolId = value; }
            }
            public bool Closed
            {
                get
                { return _Closed; }
                set
                { _Closed = value; }
            }
        }
 
        private FilterOptions filters = new FilterOptions();
 
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Master.PageTitle = "";
 
            if (!IsPostBack)
            {
                if (Request.QueryString["FunctionId"] != null)
                {
                    filters.FunctionId = Convert.ToInt32(Request.QueryString["FunctionId"].ToString());
                }
                if (Request.QueryString["FunctionToolId"] != null)
                {
                    filters.FunctionToolId = Convert.ToInt32(Request.QueryString["FunctionToolId"].ToString());
                }
                if (Request.QueryString["Closed"] != null)
                {
                    filters.Closed = Convert.ToBoolean(Request.QueryString["Closed"].ToString());
                }
 
                Session["Filters"] = filters;
            }
            else
            {
                if ((Session["Filters"] == null) == false)
                {
                    filters = (FilterOptions)Session["Filters"];
                }
 
            }
        }
 
 
        private void show_error_message(string error_message)
        {
            string error = error_message.Replace("'", "");
 
            main_ajaxmanager.ResponseScripts.Add(string.Format("window.radalert(\"" + error + "\")"));
        }
 
        protected void requests_grid_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            try
            {
                using (RequestsDataContext sdc = new RequestsDataContext(string.Empty))
                {
                    this.requests_grid.DataSource = sdc.GetRequestDetail(-1, filters.FunctionId, filters.FunctionToolId, filters.Closed).ToList<Request>();
                }
            }
            catch (Exception ex)
            {
                LogError(ex);
                show_error_message(ex.Message);
            }
 
        }
 
        private void SaveRequest(GridBatchEditingCommand grdItem)
        {
 
            Hashtable newValues = grdItem.NewValues;
            Hashtable oldValues = grdItem.OldValues;
            int RequestId = 0;
            if (grdItem.Type == GridBatchEditingCommandType.Update)
            {
                RequestId = (string.IsNullOrEmpty(grdItem.Item.GetDataKeyValue("RequestId").ToString())) ? 0 : Convert.ToInt32(grdItem.Item.GetDataKeyValue("RequestId").ToString());
            }
            //cbo = (RadComboBox)grdItem.FindControl("cboSite");
            int SiteId = 0;
            if (!string.IsNullOrEmpty(newValues["SiteId"].ToString()))
            {
                SiteId = Convert.ToInt32(newValues["SiteId"].ToString());//Convert.ToInt32(cbo.SelectedValue.ToString());
            }
            //cbo = (RadComboBox)grdItem.FindControl("cboStatus");
            int RequestStatusId = Convert.ToInt32(newValues["RequestStatusId"].ToString());//Convert.ToInt32(cbo.SelectedValue.ToString());
 
            //cbo = (RadComboBox)grdItem.FindControl("cboFunctionTool");
            int FunctionToolId = Convert.ToInt32(newValues["FunctionToolId"].ToString());//Convert.ToInt32(cbo.SelectedValue.ToString());
 
            //cbo = (RadComboBox)grdItem.FindControl("cboPriority");
            int PriorityId = Convert.ToInt32(newValues["PriorityId"].ToString());//Convert.ToInt32(cbo.SelectedValue.ToString());
 
            //cbo = (RadComboBox)grdItem.FindControl("cboRequestType");
            int RequestTypeId = Convert.ToInt32(newValues["RequestTypeId"].ToString());//Convert.ToInt32(cbo.SelectedValue.ToString());
 
            //txtBox = (RadTextBox)grdItem.FindControl("txtRequestTitle");
            string RequestTitle = newValues["RequestTitle"].ToString();//txtBox.Text.ToString();
 
            //cbo = (RadComboBox)grdItem.FindControl("cboAssignedTo");
            //dte =(RadDatePicker)grdItem.FindControl("dpEstimatedStartDate");
            Nullable<int> AssignedTo;
            if (string.IsNullOrEmpty(newValues["AssignedTo"].ToString()))
            {
                AssignedTo = null;
            }
            else
            {
                AssignedTo = Convert.ToInt32(newValues["AssignedTo"].ToString());
                //AssignationDate=(string.IsNullOrEmpty(dte.DateInput.SelectedDate.ToString())) ? DateTime.Today : dte.DateInput.SelectedDate;
            }
 
            Nullable<DateTime> ClosingDate = null;
 
            //ntxtBox = (RadNumericTextBox)grdItem.FindControl("Sequence");
            int Sequence = Convert.ToInt32(newValues["Sequence"].ToString());//Convert.ToInt32(ntxtBox.Text.ToString());
 
            //ntxtBox = (RadNumericTextBox)grdItem.FindControl("txtEstimatedHours");
            double EstimatedHours = string.IsNullOrEmpty(newValues["EstimatedHours"].ToString()) ? 0 : Convert.ToDouble(newValues["EstimatedHours"].ToString());
 
            //dte =(RadDatePicker)grdItem.FindControl("dpEstimatedStartDate");
            Nullable<DateTime> EstimatedStartDate =  null;
            if (!string.IsNullOrEmpty(newValues["EstimatedStartDate"].ToString()))
            {
                EstimatedStartDate =  Convert.ToDateTime(newValues["EstimatedStartDate"].ToString());// dte.DateInput.SelectedDate;
            }
 
            //dte =(RadDatePicker)grdItem.FindControl("dpEstimatedStartDate");
            Nullable<DateTime> EstimatedCompletionDate = null;
            if (!string.IsNullOrEmpty(newValues["EstimatedCompletionDate"].ToString()))
            {
                EstimatedCompletionDate = Convert.ToDateTime(newValues["EstimatedCompletionDate"].ToString());//dte.DateInput.SelectedDate;
            }
            //ntxtBox = (RadNumericTextBox)grdItem.FindControl("txtActualHours");
            double ActualHours = string.IsNullOrEmpty(newValues["ActualHours"].ToString()) ? 0 : Convert.ToDouble(newValues["ActualHours"].ToString());
 
            //dte =(RadDatePicker)grdItem.FindControl("dpActualStartDate");
            Nullable<DateTime> ActualStartDate = null;
            if (!string.IsNullOrEmpty(newValues["ActualStartDate"].ToString()))
            {
                ActualStartDate = Convert.ToDateTime(newValues["ActualStartDate"].ToString());//dte.DateInput.SelectedDate;
            }
 
            //ntxtBox = (RadNumericTextBox)grdItem.FindControl("txtFixedCosts");
            double FixedCosts = string.IsNullOrEmpty(newValues["FixedCosts"].ToString()) ? 0 : Convert.ToDouble(newValues["FixedCosts"].ToString());
 
            //cbo = (RadComboBox)grdItem.FindControl("cboDivision");
            int DivisionId = -1;
            if (!string.IsNullOrEmpty(newValues["DivisionId"].ToString()))
            {
                DivisionId = Convert.ToInt32(newValues["DivisionId"].ToString());//Convert.ToInt32(cbo.SelectedValue.ToString());
            }
            int ParentRequestId = 0;
 
            int UpdatedBy = (this.User as FrameworkPrincipal).UserId;
            int RequestedBy = (this.User as FrameworkPrincipal).UserId;
            bool IsAvailable = true;
 
            //txtBox = (RadTextBox)grdItem.FindControl("txtNewComment");
            string Comments = newValues["Comments"].ToString();//txtBox.Text.ToString();
 
            int NewRequestId = 0;
            using (RequestsDataContext rdc = new RequestsDataContext(string.Empty))
            {
                int result = rdc.UpdateRequest(RequestId, SiteId, RequestStatusId, FunctionToolId, PriorityId,
                    RequestTypeId, RequestTitle, AssignedTo,  ClosingDate, Sequence, EstimatedHours,
                    EstimatedStartDate, EstimatedCompletionDate, ActualHours, ActualStartDate, FixedCosts, DivisionId,
                    ParentRequestId, RequestedBy, UpdatedBy, IsAvailable, ref NewRequestId);
                if (NewRequestId != 0)
                {
                    //Save comment with new id
                    if (!string.IsNullOrEmpty(Comments))
                    {
 
                        result = rdc.UpdateRequestNote(0, NewRequestId, Comments, UpdatedBy);
                    }
 
                    //foreach (UploadedFile file in this.AsyncUpload.UploadedFiles)
                    //{
                    //    string fileName = file.FileName;
                    //    string fileExtension = file.GetExtension();
                    //    string contentType = file.ContentType;
                    //    byte[] fileContent = new byte[file.InputStream.Length];
                    //    using (Stream str = file.InputStream)
                    //        str.Read(fileContent, 0, (int)file.ContentLength);
 
                    //    result = rdc.UpdateSupportFile(0, NewRequestId, fileName, contentType, fileContent, UpdatedBy, true);
                    //}
                    this.requests_grid.Rebind();
                }
            }
        }
         
        protected void requests_grid_BatchEditCommand(object sender, Telerik.Web.UI.GridBatchEditingEventArgs e)
        {
            try
            {
                GridDataItem grdItem;
 
                 
                foreach (GridBatchEditingCommand command in e.Commands)
                {
 
                    grdItem = command.Item;
 
                    if (command.Type == GridBatchEditingCommandType.Update || command.Type == GridBatchEditingCommandType.Insert)
                    {
                        SaveRequest(command);
                    }
                    //switch (command.Type)
                    //{
                    //    case GridBatchEditingCommandType.Update:
                    //        SaveRequest(command);
                    //        break;
                    //    //case GridBatchEditingCommandType.Delete:
                    //    //    BenchmarkID = Convert.ToInt32(grdItem.GetDataKeyValue("BenchmarkGroupID"));
                    //    //    DeleteBenchmarkGroup(BenchmarkID);
                    //    //    break;
                    //    case GridBatchEditingCommandType.Insert:
                    //        SaveRequest(command);
                    //        break;
                    //}
                }
            }
            catch (Exception ex)
            {
                LogError(ex);
                show_error_message(ex.Message);
            }
        }
 
        protected void requests_grid_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            }
 
        }
 
        protected void requests_grid_ItemDataBound(object sender, GridItemEventArgs e)
        {
            try
            {
                if (e.Item is GridEditableItem && e.Item.IsInEditMode)
                {
                    GridEditableItem editedItem = e.Item as GridEditableItem;
 
                    RadComboBox ddlFunctionTool = (RadComboBox)editedItem.FindControl("cboFunctionTool");
                    using (FunctionDataContext sdc = new FunctionDataContext(string.Empty))
                    {
                        foreach (Function_FunctionToolCBO this_item in sdc.GetFunction_FunctionToolList().ToList<Function_FunctionToolCBO>())
                        {
                            ddlFunctionTool.Items.Add(new Telerik.Web.UI.RadComboBoxItem(this_item.FunctionToolName.ToString(), this_item.FunctionToolId.ToString()));
                        }
 
                    }
                }
 
                if (e.Item is GridDataItem)
                {
                    //Put all data items in Edit. We will need to call Rebind() method in
                    //PreRender event in order for the changes to take effect.
                    //GridDataItem dataItem = e.Item as GridDataItem;
                    //dataItem.Edit = true;
                }
 
                if (e.Item is GridFilteringItem)
                {
                }
            }
            catch (Exception ex)
            {
                LogError(ex);
                show_error_message(ex.Message);
            }
        }
 
 
  
        //Get the values from the different editors prior the synchronization of the database.
        private object GetColumnValue(GridColumn column, GridDataItem item)
        {
            Hashtable table = new Hashtable();
            item.ExtractValues(table);
            return table[column.UniqueName];
        }
 
        ////Provide the needed information to the editor control of the different columns
        //private void PrepareEditorControl(GridColumn column, int i, GridDataItem item)
        //{
        //    switch (column.ColumnType)
        //    {
        //        case "GridBoundColumn":
        //            {
        //                TextBox textBox = (item[column.UniqueName].Controls[0]) as TextBox;
        //                //SetupControl(textBox, item.ItemIndex, i);
        //                textBox.Width = Unit.Percentage(100);
        //                //textBox.Style.Add("width", "100%");
        //            }
        //            break;
        //        case "GridCheckBoxColumn":
        //            {
        //                CheckBox checkBox = (item[column.UniqueName].Controls[0]) as CheckBox;
        //                //SetupControl(checkBox, item.ItemIndex, i);
        //            }
        //            break;
        //        case "GridDropDownColumn":
        //            {
        //                GridDropDownColumn dropDownColumn = column as GridDropDownColumn;
        //                switch (dropDownColumn.DropDownControlType)
        //                {
        //                    case GridDropDownColumnControlType.DropDownList:
        //                        {
        //                            DropDownList dropDown = (item[column.UniqueName].Controls[0]) as DropDownList;
        //                            //SetupControl(dropDown, item.ItemIndex, i);
        //                        }
        //                        break;
        //                    default:
        //                        {
        //                            RadComboBox comboBox = (item[column.UniqueName].Controls[0]) as RadComboBox;
        //                            //SetupControl(comboBox, item.ItemIndex, i);
        //                        }
        //                        break;
        //                }
        //            }
        //            break;
        //        case "GridDateTimeColumn":
        //            {
        //                RadDatePicker picker = (item[column.UniqueName].Controls[0]) as RadDatePicker;
        //                //SetupControl(picker.DateInput, item.ItemIndex, i);
        //                //SetupControl(picker, item.ItemIndex, i);
 
 
        //                RadDateInput dateInput = item[column.UniqueName].Controls[0] as RadDateInput;
        //                if (dateInput != null)
        //                {
        //                    dateInput.Skin = "";
        //                    dateInput.EnableEmbeddedBaseStylesheet = false;
        //                    dateInput.EnableEmbeddedSkins = false;
        //                    //SetupControl(dateInput, item.ItemIndex, i);
        //                }
 
        //            }
        //            break;
        //        case "GridNumericColumn":
        //            {
        //                RadNumericTextBox numericTextBox = (item[column.UniqueName].Controls[0]) as RadNumericTextBox;
 
        //                if (numericTextBox != null)
        //                {
        //                    numericTextBox.SelectionOnFocus = SelectionOnFocus.None;
        //                    numericTextBox.IncrementSettings.InterceptArrowKeys = false;
        //                    numericTextBox.Width = Unit.Pixel(140);
        //                    numericTextBox.Skin = "";
        //                    //SetupControl(numericTextBox, item.ItemIndex, i);
        //                }
        //            }
        //            break;
        //        case "GridMaskedColumn":
        //            {
        //                RadMaskedTextBox maskedTextBox = (item[column.UniqueName].Controls[0]) as RadMaskedTextBox;
 
        //                if (maskedTextBox != null)
        //                {
        //                    maskedTextBox.SelectionOnFocus = SelectionOnFocus.None;
        //                    maskedTextBox.Skin = "";
        //                    maskedTextBox.Width = Unit.Pixel(140);
        //                    //SetupControl(maskedTextBox, item.ItemIndex, i);
        //                }
        //            }
        //            break;
        //    }
        //}
 
        //private void SetupControl(WebControl control, int itemIndex, int colIndex)
        //{
        //    if (control == null) return;
 
        //    CheckBox checkBox = control as CheckBox;
        //    RadDatePicker picker = control as RadDatePicker;
        //    if (checkBox != null)
        //    {
        //        //Adds the click and dblclick event handlers to the HTML element
        //        control.Attributes.Add("ondblclick", "cellDoubleClickFunction('" + control.ClientID + "');");
        //        control.Attributes.Add("onclick", "cellClick('" + control.ClientID + "');");
        //        checkBox.InputAttributes.Add("class", "row" + itemIndex + "col" + colIndex);
        //        return;
        //    }
        //    else if (picker != null)
        //    {
        //        picker.DateInput.Skin = "";
        //        picker.Skin = "";
        //        picker.DateInput.EnableEmbeddedBaseStylesheet = false;
        //        picker.DateInput.EnableEmbeddedSkins = false;
        //        //We enable the PopUpOnFocus so when we focus the cell with the keyboard to be
        //        //able to choose the directly without clicking the cell again.
        //        picker.ShowPopupOnFocus = true;
        //        //Enable the keyboard navigation.        
        //        picker.SharedCalendar.EnableKeyboardNavigation = true;
        //        //Hide the button for the PopUp, we do not need this, because we are showing the popup on focus.
        //        picker.DatePopupButton.Visible = false;
        //        //We hook this event in order to clear the selected cells and continue the navigation with the keyboard.
        //        picker.ClientEvents.OnPopupClosing = "PopUpClosing";
        //        //Adds the click and dblclick event handlers to the HTML element
        //        picker.Attributes.Add("ondblclick", "cellDoubleClickFunction('" + picker.ClientID + "');");
        //        picker.Attributes.Add("onclick", "cellClick('" + picker.ClientID + "');");
        //        //Assign a unique CSS class to each editor control so we could access it afterwards through JQuery.
        //        picker.DateInput.CssClass = "row" + itemIndex + "col" + colIndex;
        //        return;
        //    }
        //    //Adds the click and dblclick event handlers to the HTML element
        //    control.Attributes.Add("ondblclick", "cellDoubleClickFunction('" + control.ClientID + "');");
        //    control.Attributes.Add("onclick", "cellClick('" + control.ClientID + "');");
        //    //Assign a unique CSS class to each editor control so we could access it afterwards through JQuery.
        //    control.CssClass = "row" + itemIndex.ToString() + "col" + colIndex.ToString();
        //}
 
 
        protected void cboFunctionTool_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
        {
            using (FunctionDataContext sdc = new FunctionDataContext(string.Empty))
            {
                RadComboBox ddl = (RadComboBox)sender;
                foreach (Function_FunctionToolCBO this_item in sdc.GetFunction_FunctionToolList().ToList<Function_FunctionToolCBO>())
                {
                    ddl.Items.Add(new Telerik.Web.UI.RadComboBoxItem(this_item.FunctionToolName.ToString(), this_item.FunctionToolId.ToString()));
                }
 
            }
 
        }
 
        private void FillUsers(RadComboBox ddl)
        {
            using (GeneralDataContext sdc = new GeneralDataContext(string.Empty))
            {
                foreach (SystemUserCBO this_item in sdc.GetUserList().ToList<SystemUserCBO>())
                {
                    ddl.Items.Add(new Telerik.Web.UI.RadComboBoxItem(this_item.UserName.ToString(), this_item.UserId.ToString()));
                }
 
            }
 
        }
 
        private void PopulateDivisions(RadComboBox ddl)
        {
            using (CommonDataContext sdc = new CommonDataContext(string.Empty))
            {
                foreach (Division this_item in sdc.GetDivisionList().ToList<Division>())
                {
                    ddl.Items.Add(new Telerik.Web.UI.RadComboBoxItem(this_item.DivisionName.ToString(), this_item.dimDivisionId.ToString()));
                }
            }
        }
 
        private void PopulatePriority(RadComboBox ddl)
        {
            using (PrioritiesDataContext sdc = new PrioritiesDataContext(string.Empty))
            {
                foreach (PriorityCBO this_item in sdc.GetPrioritiesList().ToList<PriorityCBO>())
                {
                    ddl.Items.Add(new Telerik.Web.UI.RadComboBoxItem(this_item.PriorityName.ToString(), this_item.PriorityId.ToString()));
                }
            }
 
        }
 
        private void PopulateCategory(RadComboBox ddl)
        {
            using (CategoriesDataContext sdc = new CategoriesDataContext(string.Empty))
            {
                foreach (RequestTypeCBO this_item in sdc.GetRequestTypeList().ToList<RequestTypeCBO>())
                {
                    ddl.Items.Add(new Telerik.Web.UI.RadComboBoxItem(this_item.RequestTypeName.ToString(), this_item.RequestTypeId.ToString()));
                }
            }
 
        }
 
        private void PopulateStatus(RadComboBox ddl)
        {
            using (RequestsDataContext rdc = new RequestsDataContext(string.Empty))
            {
                foreach (RequestStatusCBO this_item in rdc.GetRequestStatusList().ToList<RequestStatusCBO>())
                {
                    ddl.Items.Add(new Telerik.Web.UI.RadComboBoxItem(this_item.RequestName.ToString(), this_item.RequestStatusId.ToString()));
                }
            }
        }
 
        private void PopulateSites(RadComboBox ddl)
        {
            using (SystemDataContext sdc = new SystemDataContext(string.Empty))
            {
                foreach (SystemSiteCBO this_item in sdc.GetSitesList().ToList<SystemSiteCBO>())
                {
                    ddl.Items.Add(new Telerik.Web.UI.RadComboBoxItem(this_item.SiteName.ToString(), this_item.SiteId.ToString()));
                }
            }
        }
         
        protected void cboAssignedTo_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
        {
            FillUsers((RadComboBox)sender);
        }
 
        protected void cboRequestedBy_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
        {
            FillUsers((RadComboBox)sender);
        }
 
        protected void cboRequestType_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
        {
            PopulateCategory((RadComboBox)sender);
        }
 
        protected void cboPriority_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
        {
            PopulatePriority((RadComboBox)sender);
        }
 
        protected void cboDivision_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
        {
            PopulateDivisions((RadComboBox)sender);
        }
 
        protected void cboStatus_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
        {
            PopulateStatus((RadComboBox)sender);
        }
 
        protected void cboSite_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
        {
            PopulateSites((RadComboBox)sender);
        }
 
 
        //protected void requests_grid_PreRender(object sender, EventArgs e)
        //{
        //    foreach (GridDataItem item in requests_grid.MasterTableView.Items)
        //    {
        //        if (item.IsInEditMode)
        //        {
        //            for (int i = 2; i < requests_grid.MasterTableView.RenderColumns.Length; i++)
        //            {
        //                //We this loop to provide the necessary information to the editor controls.
        //                //We will use this information to navigate through the cells of RadGrid.
        //                GridColumn column = requests_grid.MasterTableView.RenderColumns[i];
        //                PrepareEditorControl(column, i, item);
        //            }
        //        }
 
        //    }
 
        //}
 
 
 
 
 
     }
}
Shinu
Top achievements
Rank 2
 answered on 29 Aug 2014
4 answers
207 views
I open a RadWindow where the user provides data and then presses an OK button.  On postback, the data is processed and a status is generated.  I'm trying to show that status via a notification popup on the main page that opened the window.  

I modified this example for my purposes so that I can pass the result back:  http://www.telerik.com/forums/refresh-radgrid-on-close-of-radwindow

The problem is that the AjaxRequest event fires before the OK button click and so the status is unknown at this point.  Is there another scenario I can use to pass a value back server side?
Shinu
Top achievements
Rank 2
 answered on 29 Aug 2014
5 answers
184 views
Hi,

I have a RadGrid with Paging, Sorting and Filtering enabled. The datasource is provided in the code-behind using the NeedDataSource event.
Now I want to select a row with a certain DataKeyValue. This is currently done with the folowing method I created:
public void SelectRow<DataKeyType>(DataKeyType dataKeyValue)  
{  
    int index = 0;  
    foreach (Telerik.Web.UI.DataKey key in this.MasterTableView.DataKeyValues)  
    {  
        DataKeyType value = key.Values.OfType<DataKeyType>().FirstOrDefault();  
        this.MasterTableView.Items[index].Selected = (value.Equals(dataKeyValue));  
        index++;  
    }  
The above code works only when the certain DataKeyValue is present on the current Grid Page. Only the DataKeyValues of the current page are present in the DataKeyValues collection.

For as far I know I cannot request the binded datasource (whith filtering and sorting implemented) from the Grid, so I cannot calculate on which Grid Page the DataKeyValue should exist.

Does anybody know how I can select a row on another Page of the Grid? Is there a way to request the binded datasource from the Grid, so I can calculate the PageIndex of the row which must be selected?

Thanx,
Danny
Princy
Top achievements
Rank 2
 answered on 29 Aug 2014
4 answers
211 views
Hello,

I'm redesigning a page that has about 30 links that link to other places on the page and shows text about the link selected and files that can be downloaded.  I wanted to change it up and make it look better and not have the user going up and down the page.  I was thinking of something like the accordian control where I would put the text from the link as the parent and when selected all the menus will shift down and the text will display.  What is the best way to do this with telerik controls.  I'm using 2013 Q1 NET 45.   Any suggestions to a better approach to this situation?

Thank you
Jerry
Top achievements
Rank 1
 answered on 28 Aug 2014
3 answers
229 views
Hi,

Great day.
I hope someone could help me.
I would like to upload selected files up to 500 MB using chunk and rebuild it and save to SQL database
I made some test but still did not make it correct. Does anyone know how to do it?

Here's my code in client side

 
<form id="form1" runat="server">
        <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
          <script src="scripts.js" type="text/javascript"></script>
 
            <div class="qsf-demo-canvas qsf-demo-canvas-vertical" style="margin-top: 50px">
                <telerik:RadAsyncUpload runat="server" ID="AsyncUpload1" ChunkSize="1048576"
                    OnClientFilesUploaded="fileUploaded"  OnFileUploaded="AsyncUpload1_FileUploaded" Localization-Select="Add" HttpHandlerUrl="~/Handler.ashx" />
                <telerik:RadProgressArea runat="server" ID="RadProgressArea1" />
            </div>
 
    </form>


Here's the Handler.ashx.vb but don't know what to do here..

Protected Overrides Function Process(ByVal file As UploadedFile, ByVal context As HttpContext, ByVal configuration As IAsyncUploadConfiguration, ByVal tempFileName As String) As IAsyncUploadResult
        ' Call the base Process method to save the file to the temporary folder
        ' base.Process(file, context, configuration, tempFileName);
 
        ' Populate the default (base) result into an object of type SampleAsyncUploadResult
        Dim result As AsyncUploadResult = CreateDefaultUploadResult(Of AsyncUploadResult)(file)
 
        
        ' Populate any additional fields into the upload result.
        ' The upload result is available both on the client and on the server
        'result.ImageID = InsertImage(file, userID)
 
        Return result
    End Function


Here's my code behind, what will I do here?

Protected Sub Page_Load(sender As Object, e As EventArgs)
      ' Populate the default (base) upload configuration into an object of type SampleAsyncUploadConfiguration
      Dim config As AsyncUploadConfiguration = AsyncUpload1.CreateDefaultUploadConfiguration(Of AsyncUploadConfiguration)()
 
      AsyncUpload1.UploadConfiguration = config
  End Sub
 
 
  Protected Sub AsyncUpload1_FileUploaded(sender As Object, e As FileUploadedEventArgs) Handles AsyncUpload1.FileUploaded
      Dim result As AsyncUploadResult = TryCast(e.UploadResult, AsyncUploadResult)
 
      Using stream As Stream = e.File.InputStream
          Dim imgData As Byte() = New Byte(stream.Length) {}
          stream.Read(imgData, 0, imgData.Length)
          Dim ms As New MemoryStream()
          ms.Write(imgData, 0, imgData.Length)
 
          Context.Cache.Insert(Session.SessionID + "UploadedFile", ms, Nothing, DateTime.Now.AddMinutes(20), TimeSpan.Zero)
      End Using
  End Sub


Thank you in advance... God bless



Nencho
Telerik team
 answered on 28 Aug 2014
1 answer
111 views
I have a radgrid in inline edit mode which has two raddatepicker in edit mode. when someone is typing some text that is not a date the datepicker will display an error sign inside the dateinput but when the person is clicking update button it updates the database by null. I want to disable the update button when the error sign is in the inputdate box and oblige the user to correct the input text. my code is as below:
protected void ToolkitList_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem dataItem = (GridEditableItem)e.Item;
RadDatePicker pickerdue = (RadDatePicker)dataItem["ToolkitDueDate"].Controls[0];
pickerdue.ShowPopupOnFocus = true;
pickerdue.DatePopupButton.Visible = false;
pickerdue.Width = Unit.Pixel(80);


RadDatePicker pickerboard = (RadDatePicker)dataItem["BoardMeetingDate"].Controls[0];
pickerboard.ShowPopupOnFocus = true;
pickerboard.DatePopupButton.Visible = false;
pickerboard.Width = Unit.Pixel(80);


}

}

protected void ToolkitList_UpdateCommand(object sender, GridCommandEventArgs e)
{
try
{
if (e.CommandName == RadGrid.UpdateCommandName)
{
GridEditableItem editedItem = e.Item as GridEditableItem;


if (editedItem != null && editedItem.IsInEditMode)
{
                               
                        
                        int myUniqueId =
Convert.ToInt32(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex][" ID"]);
string labeloneText = string.Empty;
string labeltwoText = string.Empty;
RadDatePicker pickerdue = (RadDatePicker) editedItem["ToolkitDueDate"].Controls[0];
RadDatePicker pickerboard = (RadDatePicker) editedItem["BoardMeetingDate"].Controls[0];

if (!pickerdue.IsEmpty && !pickerboard.IsEmpty)
{

labeloneText = pickerdue.SelectedDate.ToString();
labeltwoText = pickerboard.SelectedDate.ToString();
bool success = _masterPage.ToolkitBo.UpdateDueandBoardDateForToolkit(myUniqueId,
Convert.ToDateTime(labeloneText), Convert.ToDateTime(labeltwoText),
_currentUser.FullName);

// Rebind the toolkit list to reflect the changes.
ToolkitList.Rebind();

// If it was not successful, throw an error.
if (!success)
{
throw new InvalidOperationException("Failed to add new due date.");
}
}

// Update the toolkit's due date.
if (pickerdue.IsEmpty && pickerboard.IsEmpty)
{

labeloneText = pickerdue.SelectedDate.ToString();
labeltwoText = pickerboard.SelectedDate.ToString();
bool success = _masterPage.ToolkitBo.UpdateDueandBoardDateForToolkit(myUniqueId,
null, null, _currentUser.FullName);

// Rebind the toolkit list to reflect the changes.
ToolkitList.Rebind();

// If it was not successful, throw an error.
if (!success)
{
throw new InvalidOperationException("Failed to add new due date.");
}
}

if (pickerdue.IsEmpty && !pickerboard.IsEmpty)
{
labeltwoText = pickerboard.SelectedDate.ToString();
bool success = _masterPage.ToolkitBo.UpdateDueandBoardDateForToolkit(myUniqueId,
null, Convert.ToDateTime(labeltwoText), _currentUser.FullName);

// Rebind the toolkit list to reflect the changes.
ToolkitList.Rebind();

// If it was not successful, throw an error.
if (!success)
{
throw new InvalidOperationException("Failed to add new due date.");
}
}
if (!pickerdue.IsEmpty && pickerboard.IsEmpty)
{
labeloneText = pickerdue.SelectedDate.ToString();
bool success = _masterPage.ToolkitBo.UpdateDueandBoardDateForToolkit(myUniqueId,
Convert.ToDateTime(labeloneText), null, _currentUser.FullName);

// Rebind the toolkit list to reflect the changes.
ToolkitList.Rebind();

// If it was not successful, throw an error.
if (!success)
{
throw new InvalidOperationException("Failed to add new due date.");
}
}
}
}

}
catch (Exception err)
{
                
 }
Konstantin Dikov
Telerik team
 answered on 28 Aug 2014
6 answers
186 views
Can RadautoComplete be used in the EditItemTemplate of a radgrid? I am trying to use it there but having a problem seeing the data


Thank you

Jack
jack
Top achievements
Rank 1
 answered on 28 Aug 2014
1 answer
183 views
I don't understand why client-side validation is not working.  I have followed the following examples

http://demos.telerik.com/aspnet-ajax/input/examples/common/validation/defaultvb.aspx?#qsf-demo-source

What do I need to do in order to get this working?  This page is loaded into a RadWindow if that makes a difference.

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <div>
        <script type="text/javascript">
              function CloseAndRebind(args)
              {
                  //alert("Record Updated!");
                  GetRadWindow().BrowserWindow.refreshGrid(args);
                  GetRadWindow().close();
              }
 
              function GetRadWindow() {
                  var oWindow = null;
                  if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
                  else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz as well)
                  return oWindow;
              }
 
              function CancelEdit() {
                  GetRadWindow().close();
              }
 
 
 
        </script>
<%--<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">--%>
    <table width="98%" style="margin-left: auto; margin-right: auto; ">
    <tr>
        <th class="contenttableheader">Contacts</th>
    </tr>
    <tr>
        <td class="contenttableboxcontent">
            <table style="border-width: 0px; width: 100%; text-align: left; vertical-align: top;" cellspacing="2" cellpadding="5" class="Table1">
                <tr><td class="TitleBar" colspan="3">Contacts  </td></tr>
                <tr>
                    <td colspan="3" style="text-align: center;"><asp:Label ID="_lblErrorMsg" runat="server" Text="" CssClass="alert"></asp:Label></td>
                </tr
                <tr>
                    <td class="LabelStyle">M/M</td>
                    <td class="LabelStyle">First Name</td>
                    <td class="LabelStyle">Last Name</td>
                </tr>
                <tr>
                    <td><telerik:RadDropDownList ID="_mm" runat="server" CssClass="InputSelect" DefaultMessage="Select Title">
                            <Items>
                                <telerik:DropDownListItem Value="Dr." Text="Dr." />
                                <telerik:DropDownListItem Value="Mr." Text="Mr." />
                                <telerik:DropDownListItem Value="Mrs." Text="Mrs." />
                                <telerik:DropDownListItem Value="Ms." Text="Ms." />
                                <telerik:DropDownListItem Value="Rev." Text="Rev." />
                            </Items>
                        </telerik:RadDropDownList>
                        <asp:RequiredFieldValidator runat="server" ID="_mmValidate" ControlToValidate="_mm" Text="*" ForeColor="Red" ErrorMessage="Mr./Mrs./Ms. is Required<br />" ValidationGroup="_validationProfile" EnableClientScript="true" Display="Dynamic" InitialValue="Select Title"></asp:RequiredFieldValidator>
                    </td>
                    <td><telerik:RadTextBox ID="_firstName" runat="server"></telerik:RadTextBox></td>
                    <td><telerik:RadTextBox ID="_lastName" runat="server"></telerik:RadTextBox></td>
                </tr>
                <tr>
                    <td class="LabelStyle">Title</td>
                    <td class="LabelStyle">Phone 1</td>
                    <td class="LabelStyle">Phone 2</td>
                </tr>
                <tr>
                    <td><telerik:RadTextBox ID="_title" runat="server"></telerik:RadTextBox></td>
                    <td><telerik:RadMaskedTextBox ID="_Phone1" runat="server" Mask="(###) ###-####" ValidationGroup="Group1"></telerik:RadMaskedTextBox>
<%--                            <asp:RequiredFieldValidator Display="Dynamic" ID="MaskedTextBoxRequiredFieldValidator"
                            runat="server" ErrorMessage="Please, enter a phone number." ControlToValidate="_Phone1"></asp:RequiredFieldValidator>--%>
                            <asp:RegularExpressionValidator Display="Dynamic" ID="MaskedTextBoxRegularExpressionValidator"
                            runat="server" ErrorMessage="Format is (###) ###-####" ControlToValidate="_Phone1"
                            ValidationExpression="\(\d{3}\) \d{3}-\d{4}" EnableClientScript="true" ValidationGroup="_validationProfile"></asp:RegularExpressionValidator>  ext. <telerik:RadTextBox ID="_phone1Ext" runat="server" Width="75"/>
                    </td>
                    <td><telerik:RadMaskedTextBox ID="_phone2" runat="server" Mask="(###) ###-####" ValidationGroup="Group1"></telerik:RadMaskedTextBox>
<%--                            <asp:RequiredFieldValidator Display="Dynamic" ID="RequiredFieldValidator1"
                            runat="server" ErrorMessage="Please, enter a phone number." ControlToValidate="_Phone2"></asp:RequiredFieldValidator>--%>
                            <asp:RegularExpressionValidator Display="Dynamic" ID="RegularExpressionValidator1"
                            runat="server" ErrorMessage="Format is (###) ###-####" ControlToValidate="_Phone2"
                            ValidationExpression="\(\d{3}\) \d{3}-\d{4}" EnableClientScript="true" ValidationGroup="_validationProfile"></asp:RegularExpressionValidator>  ext. <telerik:RadTextBox ID="_phone2Ext" runat="server" Width="75"/>
                    </td>
                </tr>
                <tr>
                    <td class="LabelStyle">Fax</td>
                    <td class="LabelStyle">Contact Email</td>
                </tr>
                <tr>
                    <td><telerik:RadMaskedTextBox ID="_Fax" runat="server" Mask="(###) ###-####" ValidationGroup="Group1"></telerik:RadMaskedTextBox>
                            <asp:RegularExpressionValidator Display="Dynamic" ID="RegularExpressionValidator2"
                            runat="server" ErrorMessage="Format is (###) ###-####" ControlToValidate="_Fax"
                            ValidationExpression="\(\d{3}\) \d{3}-\d{4}" EnableClientScript="true"></asp:RegularExpressionValidator></td>
                    <td><telerik:RadTextBox ID="_email" runat="server"></telerik:RadTextBox>
                        <asp:RegularExpressionValidator ID="emailValidator" runat="server" Display="Dynamic"
                            ErrorMessage="Please, enter valid e-mail address." ValidationExpression="^[\w\.\-]+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]{1,})*(\.[a-zA-Z]{2,3}){1,2}$"
                            ControlToValidate="_email" EnableClientScript="true" ValidationGroup="_validationProfile">
                        </asp:RegularExpressionValidator>
                    </td>
                </tr>
                <tr>
                    <td colspan="3" style="text-align: right;">
                        <telerik:RadButton ID="_btnCancel" runat="server" Text="Cancel"></telerik:RadButton>
                        <telerik:RadButton ID="_btnSave" runat="server" Text="Save"></telerik:RadButton>
 
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
        <asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="_validationProfile" ShowMessageBox="true" ShowSummary="true" />
<%--        </telerik:RadAjaxPanel>
             
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"></telerik:RadAjaxLoadingPanel>--%>
    </div>
</asp:Content>
Kurt Kluth
Top achievements
Rank 1
 answered on 28 Aug 2014
1 answer
130 views
Hi Telerik Team,


I'm trying to set the position of the RadSplitter in RadFileExplorer but no success with that.
I attached two images, the first image is the way it look's now and the second image is how I want it to be
please help me to achieve what I desire
Vessy
Telerik team
 answered on 28 Aug 2014
2 answers
311 views
Hi to all,

I'm trying to use the basic filtering of the grid but in my GridDateTimeColumn i'm getting this error when trying to filter the column:

The argument types 'Edm.DateTimeOffset' and 'Edm.String' are incompatible for this operation. Near greater than or equals expression, line 6, column 21.

Here is my code:

HTML

<%@ Page Title="Logs" Language="C#" MasterPageFile="~/Platform/Site.Platform.Master" AutoEventWireup="true" CodeBehind="LogsList.aspx.cs" Inherits="UI.LogsList" %>

<asp:Content ID="HeaderContent" ContentPlaceHolderID="HeaderContent" runat="server">
</asp:Content>

<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
    <div style="height: 50px;">
        <asp:Label runat="server" ID="LabelPageTitle" CssClass="h3 GridTitle">Logs</asp:Label>
    </div>
    <div>
        <!-- Define the datasource -->
        <ef:EntityDataSource ID="EntityDataSourceLogs" runat="server" ContextTypeName="Common.EntityModels.PlatformDB" ConnectionString="name=PlatformDB"
            DefaultContainerName="PlatformDB"
            EnableUpdate="False" EnableDelete="False" EnableInsert="False"
            EntitySetName="Logs" OrderBy="it.CreatedDateTime desc" />
        <!-- Define the grid -->
        <telerik:RadGrid runat="server" ID="RadGridLogs" AllowPaging="True" AllowSorting="true" Height="578" DataSourceID="EntityDataSourceLogs">
            <GroupingSettings CaseSensitive="false"></GroupingSettings>
            <MasterTableView DataKeyNames="Id" AutoGenerateColumns="False" AllowPaging="true"
                AllowAutomaticInserts="false" ClientDataKeyNames="Id" AllowFilteringByColumn="true" >
                <Columns>
                    <telerik:GridBoundColumn DataField="Id" HeaderText="Id" SortExpression="Id" UniqueName="Id" Visible="false" MaxLength="100">
                    </telerik:GridBoundColumn>
                    <telerik:GridDateTimeColumn DataField="CreatedDateTime" HeaderText="Date" SortExpression="CreatedDateTime" Visible="true" MaxLength="50" ItemStyle-Width="50" FilterControlWidth="150px" PickerType="DatePicker" DataFormatString="{0:d}" AutoPostBackOnFilter="true" CurrentFilterFunction="GreaterThanOrEqualTo" ShowFilterIcon="false" EnableTimeIndependentFiltering="true">
                    </telerik:GridDateTimeColumn>

                    <telerik:GridBoundColumn DataField="Description" HeaderText="Description" SortExpression="Description" UniqueName="Description" Visible="true" MaxLength="100" ItemStyle-Width="100" FilterControlWidth="300px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" >
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Server" HeaderText="Server" SortExpression="Server" UniqueName="Server" Visible="true" MaxLength="50" ItemStyle-Width="50" FilterControlWidth="150px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" >
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Application" HeaderText="Application" SortExpression="Application" UniqueName="Application" Visible="true" MaxLength="50" ItemStyle-Width="50" FilterControlWidth="150px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" >
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Module" HeaderText="Module" SortExpression="Module" UniqueName="Module" Visible="true" MaxLength="50" ItemStyle-Width="50" FilterControlWidth="150px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" >
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Function" HeaderText="Function" SortExpression="Function" UniqueName="Function" Visible="true" MaxLength="50" ItemStyle-Width="50" FilterControlWidth="150px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" >
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
            <ClientSettings EnableRowHoverStyle="true">
                <Selecting AllowRowSelect="False"></Selecting>
                <Scrolling AllowScroll="True" UseStaticHeaders="True" />
            </ClientSettings>
            <PagerStyle AlwaysVisible="true" Mode="NextPrevAndNumeric" Position="Bottom" PageSizeControlType="RadComboBox"></PagerStyle>
        </telerik:RadGrid>
    </div>
</asp:Content>

C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace UI
{
    public partial class LogsList : DetailBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}


The entity value of the field is:

namespace Common.EntityModels
{
    using System;
    using System.Collections.Generic;
    
    public partial class Log
    {
        public long Id { get; set; }
        public System.DateTimeOffset CreatedDateTime { get; set; }
        public short Type { get; set; }
        public string Description { get; set; }
        public string Server { get; set; }
        public string Application { get; set; }
        public string Module { get; set; }
        public string Function { get; set; }
        public Nullable<int> TenantId { get; set; }
        public Nullable<int> UserId { get; set; }
        public string SessionId { get; set; }
    }
}


And in SQL is:

[CreatedDateTime]   DATETIMEOFFSET (7)  NOT NULL

Can you tell me what i'm doing wrong??

Thanks.




Marco
Top achievements
Rank 2
 answered on 28 Aug 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?