Telerik Forums
UI for ASP.NET AJAX Forum
7 answers
340 views
How do we change the case sensitivity for the CAPTCHA when using the SendMail SocialNetType? When presented to end-users, there is no notification about case sensitivity and they could potentially get frustrated because the CAPTCHA error returns "Please, reenter the code in the captcha", even though the code IS entered in correctly, but in lowercase.
moegal
Top achievements
Rank 1
 answered on 06 Jun 2013
4 answers
237 views
Like the title describes, I'd like to prevent the "select all" checkbox within the header of the GridClientSelectColumn from firing or being selected automatically when all rows in the grid (current page) have been selected manually by the user (I believe it did not automatically select the header checkbox in some older versions).  The reason is that we are treating this header checkbox a little differently and when the user specifically checks this "select all" checkbox, it will check all rows of the current page AND we will check for it behind the scenes to select all items that have been returned for this specific query - but we also want the user to be able to select just those items on the current page if they wish without having this header checbox become checked.

I hope that makes sense and I appreciate the help!
Chau
Top achievements
Rank 1
 answered on 06 Jun 2013
3 answers
192 views
I have following chart I want to set two things using C#
  1. How can I set x-axis legends below chart not below axis since it overlaping lines?
  2. I am setting tooltip is not appearing like this "{0} Sentiment - {1} Volume"?

Chart Preview

private void FillChart(IEnumerable<EntitySearchResponse> data)
  {
      SentimentChart.ChartTitle.Text = "Sentemants Per day";
 
      SentimentChart.PlotArea.YAxis.TitleAppearance.Text = "Sentimants %";
 
 
      SentimentChart.PlotArea.XAxis.LabelsAppearance.RotationAngle = 90;
      SentimentChart.PlotArea.XAxis.Step = 10;
      SentimentChart.PlotArea.XAxis.Items.Clear();
 
      foreach (var date in data.Select(x => x.Date).Distinct())
      {
          var axisItem = new AxisItem(date.ToString("ddd dd"));
          SentimentChart.PlotArea.XAxis.Items.Add(axisItem);
      }
 
      SentimentChart.DataSource = data;
 
      SentimentChart.PlotArea.Series.Clear();
 
      foreach (var entityName in data.Select(x => x.EntityName).Distinct())
      {
          var series = new ColumnSeries();
          series.LabelsAppearance.DataFormatString = "{0} items";
          series.TooltipsAppearance.DataFormatString = "{0} {2} items";
          series.Name = entityName;
 
          var items = data.Where(x => x.EntityName == entityName).ToList();
          foreach (var entitySearchResponse in items)
          {
              var seriesItem = new SeriesItem(entitySearchResponse.Sentiment);
              seriesItem.TooltipValue = string.Format("{0} Sentiment - {1} Volume", entitySearchResponse.Sentiment,
                                                      entitySearchResponse.Volume);
              series.Items.Add(seriesItem);
          }
          SentimentChart.PlotArea.Series.Add(series);
      }
 
  }

Danail Vasilev
Telerik team
 answered on 06 Jun 2013
1 answer
70 views
I have a chart control, and have the done print functionality by implementing the code from the telerik site. Also I have some labes on x and y axes. This labes are added from the codebehind file. When printing I am able to print the chart, but somehow the labels do not appear on the print. I want the labes also in the print

Can someone help me to bring the labes while printing?
Petar Kirov
Telerik team
 answered on 06 Jun 2013
1 answer
113 views
Is it possible to implement the following example for winforms in using the AJAX controls:

Private Sub TutorialCreatingASlideViewerWithRadRotator_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim myPicturesPath As String = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures)
    For Each fileName As String In Directory.GetFiles(myPicturesPath, "*.jpg")
        RadRotator1.Items.Add(GetThumbNail(fileName))
    Next
    RadRotator1.Start(True)
    RadRotator1.ShouldStopOnMouseOver = False
End Sub
 
Private Function GetThumbNail(ByVal path As String) As RadImageItem
    Dim imageItem As New RadImageItem()
    Dim image As Image = image.FromFile(path)
    ' workaround to prevent using internal image thumbnail
    image.RotateFlip(System.Drawing.RotateFlipType.Rotate180FlipNone)
    image.RotateFlip(System.Drawing.RotateFlipType.Rotate180FlipNone)
    ' calculate aspect ratio so image is not distorted
    Dim ratio As Double = 0
    If image.Width > image.Height Then
        ratio = ClientRectangle.Width / image.Width
    Else
        ratio = ClientRectangle.Height / image.Height
    End If
    Dim newWidth As Integer = Convert.ToInt32(image.Width * ratio)
    Dim newHeight As Integer = Convert.ToInt32(image.Height * ratio)
    imageItem.Image = image.GetThumbnailImage(newWidth, newHeight, Nothing, IntPtr.Zero)
    Return imageItem
End Function
 
Private Sub RadRotator1_BeginRotate(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.BeginRotateEventArgs) Handles RadRotator1.BeginRotate
    RadLabelElement1.Text = [String].Format("Rotating from item {0} to {1}", e.From, e.[To])
End Sub
Slav
Telerik team
 answered on 06 Jun 2013
5 answers
301 views
When filtering a column, % symbol is not recognized by radgrid filter.

Example:

Suppose there are three rows with data 3,3%,2

When i enter 3% in filter text box and click on "contains text" filter option. Both 3 & 3% are displayed in the filtered result.

Can anyone help me with this issue ?

Thanks in advance
Yoan
Telerik team
 answered on 06 Jun 2013
1 answer
174 views

So, I have this situation where I want to update the data in a RadGrid and each row's checkboxes based on what I type in RadAutoCompleteBox control. It seems to work as I want it except for the checkboxes' states. They simply preserve their checked status after I set them to check on Grid's PreRender event and after that you won't be able to manually check them either. If I didn't type anything in the RadAutoCompleteBox control and tried to check any checkbox in the grid they preserve their state. Below is my entire ASPX and C# code. Any help is appreciated.

ASPX code:

<%@ Page Title="Flightdeck - Roles" Language="C#" MasterPageFile="Admin.master" AutoEventWireup="true"
    CodeBehind="UserGroups.aspx.cs" Inherits="FlightDeck.Configure.Roles" %>
 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentAdmin" runat="server">
    <div class="main-section clearfix">
        <button class="abs-right-btn" runat="server" id="btnAddNewUserGroup">
            Add New User Group</button>
        <h2 class="h2-top-none in-b">
            Roles Admin</h2>
        <hr class="shade-hr" />
        <fieldset>
            <legend></legend>
            <label class="main-label">
                Filter by User:</label>
            <telerik:RadAutoCompleteBox ID="RadAutoCompleteBox1" runat="server" AutoPostBack="True"
                OnEntryAdded="RadAutoCompleteBox1_OnEntryAdded" OnEntryRemoved="RadAutoCompleteBox1_OnEntryRemoved"
                DataSourceID="ObjectDataSource2" Width="400" CssClass="main-input filter-user-input"
                EmptyMessage="Type a user name" Filter="StartsWith" InputType="Token" DropDownWidth="320px">
            </telerik:RadAutoCompleteBox>
            <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" OldValuesParameterFormatString="original_{0}"
                SelectMethod="GetAllActiveUsers" TypeName="Services.Configure.ConfigureService">
            </asp:ObjectDataSource>
        </fieldset>
        <div class="admin-left">
            <div class="active-roles-table hasblue table-bott">
                <h3>
                    Active Roles for
                    <%= SelectedUsers %></h3>
                <telerik:RadGrid ID="UserGroupsGrid" runat="server" AllowFilteringByColumn="True"
                    CellSpacing="0" DataSourceID="ObjectDataSource1" GridLines="None" AllowPaging="True"
                    AllowSorting="True" AllowMultiRowSelection="True" AutoGenerateColumns="False"
                    Skin="FlightDeckSkin" AllowMultiRowEdit="True" EnableEmbeddedSkins="False" OnPreRender="UserGroupsGrid_OnPreRender" >
                    <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">
                        <Selecting AllowRowSelect="True" EnableDragToSelectRows="True" />
                        <Resizing AllowColumnResize="True" AllowRowResize="false" ResizeGridOnColumnResize="false"
                            ClipCellContentOnResize="true" EnableRealTimeResize="false" />
                    </ClientSettings>
                    <MasterTableView DataSourceID="ObjectDataSource1" DataKeyNames="Id"  CssClass="zebra-table table1" EditMode="EditForms">
                        <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                        <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                            <HeaderStyle Width="20px"></HeaderStyle>
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                            <HeaderStyle Width="20px"></HeaderStyle>
                        </ExpandCollapseColumn>
                        <EditFormSettings>
                            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                            </EditColumn>
                        </EditFormSettings>
                        <Columns>
                            <telerik:GridBoundColumn DataField="Id" FilterControlAltText="Filter Id Column" HeaderText="Id"
                                ReadOnly="True" SortExpression="Id" UniqueName="Id">
                                <ItemStyle Width="20%"></ItemStyle>
                                <HeaderStyle Width="20%"></HeaderStyle>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Name" FilterControlAltText="Filter Name Column"
                                HeaderText="Name" SortExpression="Name" UniqueName="Name">
                                <ItemStyle Width="45%"></ItemStyle>
                                <HeaderStyle Width="45%"></HeaderStyle>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Users" FilterControlAltText="Filter Users Column"
                                ReadOnly="True" HeaderText="Users" SortExpression="Users" UniqueName="Users">
                                <ItemStyle Width="15%"></ItemStyle>
                                <HeaderStyle Width="15%"></HeaderStyle>
                            </telerik:GridBoundColumn>
                            <telerik:GridTemplateColumn AllowFiltering="False">
                                <ItemTemplate>
                                    <asp:LinkButton runat="server" ID="btnEdit" CssClass="edit-table" OnClick="btnEdit_OnClick"></asp:LinkButton>
                                </ItemTemplate>
                                <ItemStyle Width="9%"></ItemStyle>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn AllowFiltering="False">
                                <ItemTemplate>
                                    <asp:LinkButton ID="btnDelete" runat="server" CssClass="delete-x" OnClick="btnDelete_OnClick"></asp:LinkButton>
                                </ItemTemplate>
                                <ItemStyle Width="9%"></ItemStyle>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn" AllowFiltering="False">
                                <ItemTemplate>
                                    <asp:CheckBox ID="CheckBox1" runat="server" OnCheckedChanged="ToggleRowSelection"  AutoPostBack="True" EnableViewState="True" />
                                </ItemTemplate>
                                <HeaderTemplate>
                                    <asp:CheckBox ID="headerChkbox" runat="server" OnCheckedChanged="ToggleSelectedState"
                                        AutoPostBack="True" />
                                </HeaderTemplate>
                            </telerik:GridTemplateColumn>
                        </Columns>
                        <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
                    </MasterTableView>
                    <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
                    <FilterMenu EnableImageSprites="False">
                    </FilterMenu>
                    <HeaderContextMenu EnableEmbeddedSkins="False">
                    </HeaderContextMenu>
                </telerik:RadGrid>
                <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="DeleteUserGroups"
                    OldValuesParameterFormatString="original_{0}" SelectMethod="GetUserGroups" TypeName="Services.Configure.ConfigureService"
                    UpdateMethod="UpdateUserGroups">
                    <DeleteParameters>
                        <asp:Parameter Name="id" Type="Int32" />
                    </DeleteParameters>
                    <SelectParameters>
                        <asp:SessionParameter Name="userNames" SessionField="SelectedUsers" Type="Object" />
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="id" Type="Int32" />
                        <asp:Parameter Name="userId" Type="Int32" />
                    </UpdateParameters>
                </asp:ObjectDataSource>
            </div>
        </div>
        <div class="admin-right">
            <h3>
                Selected Roles</h3>
            <telerik:RadListBox ID="lstSelectedGroups" runat="server" CssClass="main-multiple-select selected-roles-select">
            </telerik:RadListBox>
            <button class="" runat="server" id="btnCancel">
                Cancel</button>
            <button class="dark-btn right" runat="server" id="btnUpdate">
                Update</button>
        </div>
    </div>
</asp:Content>

Code behind:

 

 

using System;
using System.Collections.Generic;
using Telerik.Web.UI;
using Services.Configure;
using System.Web.UI.WebControls;
using System.Linq;
 
namespace FlightDeck.Configure
{
    public partial class Roles : System.Web.UI.Page
    {
        public string SelectedUsers;
        private ConfigureService _service;
 
        protected void Page_Init(object sender, EventArgs e)
        {
            _service = new ConfigureService();
 
            if (!Page.IsPostBack)
            {
                Session["SelectedUsers"] = null;
                Session["selectedItems"] = null;
            }
        }
 
        protected void RadAutoCompleteBox1_OnEntryAdded(object sender, AutoCompleteEntryEventArgs e)
        {
            var users = new List<string> { e.Entry.Text };
            if (Session["SelectedUsers"] == null)
            {
                 
                Session["SelectedUsers"] = users;
                if (users.Count() > 1)
                  users.ForEach(s => SelectedUsers += s + "; ");
                else
                {
                    SelectedUsers = users.First();
                }
            }
            else
            {
                users = (List<String>) Session["SelectedUsers"];
                users.Add(e.Entry.Text);
                Session["SelectedUsers"] = users;
                if (users.Count() > 1)
                    users.ForEach(s => SelectedUsers += s + "; ");
                else
                {
                    SelectedUsers = users.First();
                }
            }
        }
 
        protected void RadAutoCompleteBox1_OnEntryRemoved(object sender, AutoCompleteEntryEventArgs e)
        {
           if (Session["SelectedUsers"] == null) return;
           
           var users = (List<String>)Session["SelectedUsers"];
           users.Remove(e.Entry.Text);
           Session["SelectedUsers"] = users;
 
           if (users.Count() > 1)
               users.ForEach(s => SelectedUsers += s + "; ");
           else if (users.Count.Equals(0))
           {
               SelectedUsers = string.Empty;
           }
           else
           {
               SelectedUsers = users.First();
           }
             
        }
 
        protected void btnEdit_OnClick(object sender, EventArgs e)
        {
            var id = Convert.ToInt32(((LinkButton) sender).CommandArgument);
            var service = new ConfigureService();
            //service.UpdateUserGroups(id);
 
        }
 
        protected void btnDelete_OnClick(object sender, EventArgs e)
        {
            var id = Convert.ToInt32(((LinkButton)sender).CommandArgument);
            var service = new ConfigureService();
            service.DeleteUserGroups(id);
        }
 
        protected void ToggleRowSelection(object sender, EventArgs e)
        {
            ((sender as CheckBox).NamingContainer as GridItem).Selected = (sender as CheckBox).Checked;
            bool checkHeader = true;
            foreach (GridDataItem dataItem in UserGroupsGrid.MasterTableView.Items)
            {
                if (!(dataItem.FindControl("CheckBox1") as CheckBox).Checked)
                {
                    checkHeader = false;
                    break;
                }
            }
            GridHeaderItem headerItem = UserGroupsGrid.MasterTableView.GetItems(GridItemType.Header)[0] as GridHeaderItem;
            (headerItem.FindControl("headerChkbox") as CheckBox).Checked = checkHeader;
 
            var checkBox1 = sender as CheckBox;
 
            List<string> selectedItemsIds;
 
            if (Session["selectedItems"] == null)
            {
                selectedItemsIds = new List<string>();
            }
            else
            {
                selectedItemsIds = (List<string>)Session["selectedItems"];
            }
 
            if (checkBox1 != null)
            {
                var gridItem = checkBox1.NamingContainer as GridItem;
                if (gridItem != null)
                    gridItem.Selected = checkBox1.Checked;
                
            }
            var strGroupId = "";
            var checkBox = sender as CheckBox;
            if (checkBox != null && checkBox.Checked)
            {
                var dataItem = (GridDataItem)((sender as CheckBox).NamingContainer as GridItem);
                if (dataItem != null)
                {
                    strGroupId = dataItem.OwnerTableView.DataKeyValues[dataItem.ItemIndex]["Id"].ToString();
                }
                if (!selectedItemsIds.Any( d => d.Equals(strGroupId)))
                    selectedItemsIds.Add(strGroupId);
 
                Session["selectedItems"] = selectedItemsIds;
             
 
            }
            var box = sender as CheckBox;
            if (box != null && box.Checked == false)
            {
                var dataItem = (GridDataItem)((sender as CheckBox).NamingContainer as GridItem);
                strGroupId = dataItem.OwnerTableView.DataKeyValues[dataItem.ItemIndex]["Id"].ToString();
                selectedItemsIds.Remove(strGroupId);
                Session["selectedItems"] = selectedItemsIds;
            }
 
            // Refresh the list box with the names of the user groups selected
            var allGroups = _service.GetAllGroups();
            lstSelectedGroups.Items.Clear();
            foreach (var id in selectedItemsIds)
            {
                var groupId = Convert.ToInt32(id);
                var userGroupViewModel = allGroups.FirstOrDefault(d => d.Id.Equals(groupId));
                if (userGroupViewModel != null)
                    lstSelectedGroups.Items.Add(new RadListBoxItem(userGroupViewModel.GroupName));
            }
        }
 
        protected void ToggleSelectedState(object sender, EventArgs e)
        {
            CheckBox headerCheckBox = (sender as CheckBox);
            foreach (GridDataItem dataItem in UserGroupsGrid.MasterTableView.Items)
            {
                (dataItem.FindControl("CheckBox1") as CheckBox).Checked = headerCheckBox.Checked;
                dataItem.Selected = headerCheckBox.Checked;
            }
 
        }
 
        protected void UserGroupsGrid_OnPreRender(object sender, EventArgs e)
        {
            var users = Session["SelectedUsers"] != null ? (List<String>)Session["SelectedUsers"] : new List<string>();
            var groupIds = _service.GetAllGroups(users).Where(d => d.Selected).Select(d => d.Id).ToList(); // get all group ids that should be marked as selected after the users had been picked
            if (users.Any())
            {
                // Find rows that all picked users belong to and mark the check box for that row
                foreach (
                    var dataItem in
                        UserGroupsGrid.MasterTableView.Items.OfType<GridDataItem>()
                                      .Where(
                                          d =>
                                          groupIds.Any(
                                              i =>
                                              i.Equals(Convert.ToInt32(d.OwnerTableView.DataKeyValues[d.ItemIndex]["Id"]))))
                    )
                {
                    dataItem.Selected = true;
                    var checkBox = dataItem.FindControl("CheckBox1") as CheckBox;
                    if (checkBox != null)
                        checkBox.Checked = true;
                }
            }
            else
            {
                if (Session["selectedItems"] != null)
                {
                    var selectedItemsIds =
                        ((List<string>) Session["selectedItems"]).Select(d => Convert.ToInt32(d)).ToList();
                                                                  
 
                    var selectedGridItems =
                        UserGroupsGrid.MasterTableView.Items.OfType<GridDataItem>()
                                      .Where(item => selectedItemsIds.Any(d => d.Equals( Convert.ToInt32(item.OwnerTableView.DataKeyValues[item.ItemIndex]["Id"]))))
                                      .ToList();
 
                    foreach (var dataItem in selectedGridItems)
                     
                    {
                        dataItem.Selected = true;
                        var checkBox = dataItem.FindControl("CheckBox1") as CheckBox;
                        if (checkBox != null)
                            checkBox.Checked = true;
                    }
 
                }
            }
 
        }
       
    }
}
Anthony
Top achievements
Rank 1
 answered on 06 Jun 2013
1 answer
143 views

Hi,
 I have an aspx.cs page which uploads the RadAsyncUpload UploadedFiles collection to Azure per the following button click event. I've been asked to upload the files automatically, as soon as the user hits the RadAsyncUpload Select button, rather than having an extra button on the page, but not sure how to do this. Any help with this would be greatly appreciated.
I need to run code similar to the below....

protected void btnAttachFiles_Click(object sender, EventArgs e)
{
    Boolean isUploaded = false;
 
    for (int i = 0; i <= RadAsyncUpload1.UploadedFiles.Count - 1; i++)
    {
        try
        {
            Telerik.Web.UI.UploadedFile file = RadAsyncUpload1.UploadedFiles[i];
       
            // upload file to azure
            byte[] fileDataByteArray = new byte[file.InputStream.Length];
            file.InputStream.Read(fileDataByteArray, 0, (int)file.InputStream.Length);
            isUploaded = myAzure.UploadBlob(fileDataByteArray, RadAsyncUpload1.UploadedFiles[i]);
 
        }
        catch (Exception exc)
        {
            lblError.Text = exc.Message;
        }
    }
}

 

Thank you very much,
Randy Sullivan

Hristo Valyavicharski
Telerik team
 answered on 06 Jun 2013
2 answers
51 views
Hello
I have several pages with RadCharts on them. When a user navigates to one of these pages in the asp.net application, he can view the chart just fine. If he tries to select another page from the menu the application logs him off and he is thrown back to the login screen. Has anyone encountered this before? If so, any suggestions would be greatly appreciated. I should  mention that all works fine in my development instance. This weird behavior is happening on the production server (in a shared hosting environment).
Thank you,
Michael
Michael Weiss
Top achievements
Rank 1
 answered on 06 Jun 2013
1 answer
38 views
Hi,

I have examined the ImageMap / RadToolTipManager demo, but my situation is a bit different.
I am using a product that builds diagrams which are then rendered using an ImageMap.
Here is a sample from the page source.  I've only shown a few lines of the map:

<MAP NAME='_mfusion_ctl00_ContentPlaceHolder_DiagramView1_ImageMap_0_0'>
<AREA SHAPE='POLY' COORDS='1385,113,1468,113,1468,113,1473,114,1476,117,1479,120,1480,125,1480,125,1480,125,1480,178,1480,178,1479,182,1476,186,1473,188,1468,189,1468,189,1385,189,1385,189,1381,188,1377,186,1375,182,1374,178,1374,125,1374,125,1375,120,1377,117,1381,114,1385,113'
            TITLE="TASK DESCRIPTION: Ensure that all relevant user info has been checked ROLE DUTIES: " ID="_mfusion_ctl00_ContentPlaceHolder_DiagramView1_ImageMap_0_0_20" href="javascript:document.getElementById('_mfusion_ctl00_ContentPlaceHolder_DiagramView1_ClickedItem').value = '20:-1:-1:-1';__doPostBack('ctl00$ContentPlaceHolder$DiagramView1','_mfusion_ctl00_ContentPlaceHolder_DiagramView1_ClickedItem');">

So my question is, how do I go about iterating through this in much the same fashion as your demo does, for an ImageMap that was not created declaratively?

Thanks for any advice.

Jim
Marin Bratanov
Telerik team
 answered on 06 Jun 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?