Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
166 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
139 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
161 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
176 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
86 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
149 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
154 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
102 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
255 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
12 answers
371 views
I am currently working on a web app that involves choosing multiple ranges of hours per day of the week.  Using the scheduler control would be way overboard with what I am trying to accomplish.  I was wondering, before I commit to using this as a solution, if the slider control has functionality for multiple ranges or if I would easily be able to modify it in order to do this?  Thanks.
Slav
Telerik team
 answered on 28 Aug 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?