Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
127 views
guys, i'd like to be able to switch the ScrollHeight in the code behind based on the pageSize selected on the grid
we do this OnItemDataBound event and set the page size seletable to 15 & 30
if (e.Item is GridPagerItem)
{
RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox");
PageSizeCombo.Items.Clear();
PageSizeCombo.Items.Add(new RadComboBoxItem("15"));
PageSizeCombo.FindItemByText("15").Attributes.Add("ownerTableViewId", InventoriesRadGrid.MasterTableView.ClientID);
PageSizeCombo.Items.Add(new RadComboBoxItem("30"));
PageSizeCombo.FindItemByText("30").Attributes.Add("ownerTableViewId", InventoriesRadGrid.MasterTableView.ClientID);
PageSizeCombo.FindItemByText(e.Item.OwnerTableView.PageSize.ToString()).Selected = true;
}
i've tried to punch into the events of the pagesizecombobox but it's not working - ANY IDEAS/ IM SURE IM MISSING SOMETHING SIMPLE
thanks
rik
Konstantin Dikov
Telerik team
 answered on 24 Dec 2014
1 answer
41 views
guys, i'd like to be able to switch the ScrollHeight in the code behind based on the pageSize selected on the grid

we do this OnItemDataBound event and set the page size seletable to 15 & 30
if (e.Item is GridPagerItem)
{
RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox");
PageSizeCombo.Items.Clear();
PageSizeCombo.Items.Add(new RadComboBoxItem("15"));
PageSizeCombo.FindItemByText("15").Attributes.Add("ownerTableViewId", InventoriesRadGrid.MasterTableView.ClientID);
PageSizeCombo.Items.Add(new RadComboBoxItem("30"));
PageSizeCombo.FindItemByText("30").Attributes.Add("ownerTableViewId", InventoriesRadGrid.MasterTableView.ClientID);
PageSizeCombo.FindItemByText(e.Item.OwnerTableView.PageSize.ToString()).Selected = true;
}

i've tried to punch into the events of the pagesizecombobox but it's not working - ANY IDEAS/ IM SURE IM MISSING SOMETHING SIMPLE
thanks
rik


protected void FixSize(object sender, GridPageSizeChangedEventArgs e)
{
RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox");
if (PageSizeCombo.SelectedItem.Value == "15")
{
InventoriesRadGrid.ClientSettings.Scrolling.ScrollHeight = 610;
}
else
{
InventoriesRadGrid.ClientSettings.Scrolling.ScrollHeight = 1220;
}
}
Konstantin Dikov
Telerik team
 answered on 24 Dec 2014
1 answer
94 views
Hello,
  I am looking the waiting cursor when data binding in radeditor like same waiting cursor in radgrid control.
This is the basic requirement of all clients when click in refresh button to binding string data. RadEditor should have feature to identify something is processing.
This is confusing to user if large content.
If you have this feature, please explain to me.


I hope you will help me to find this solution.
Thanks.
Misho
Telerik team
 answered on 24 Dec 2014
1 answer
122 views
Hello,

I want to upload multiple file upload for each row in RadGrid in BatchEdit mode.Can you please share a sample project for this scenario?
Genady Sergeev
Telerik team
 answered on 24 Dec 2014
5 answers
131 views
Hello,

Everything seems to be working except that I have two labels and I'm getting the wrong rating in my "Your rating is" label. The average rating works fine and displays in the second label. Also, the stars display the correct average on page load. But as soon as I choose a rating, it displays the AVERAGE of the average and what I rated.

For example: If there is an average of 3.6 on page load and then I rate a 5, it will display 3.642857 in the "Your rating is" label.

I have posted the code below. Any help would be greatly appreciated!
Imports System
Imports System.Collections.Generic
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
 
Imports Telerik.Web.UI
Imports System.Data
Imports System.Data.SqlClient
 
Partial Public Class _2014
    Inherits System.Web.UI.Page
 
    Protected Sub RadRating_Rate(sender As Object, e As EventArgs)
        Dim rating As RadRating = DirectCast(sender, RadRating)
        If rating.ID = "RadRating1" Then
 
            Label1.Text = "Your Rating is: " + "<span style='color:Red'>" + RadRating1.Value.ToString + "</span>"
 
            AddRating(RadRating1.Value, "Amanda", 20141)
        End If
 
        If rating.ID = "RadRating2" Then
 
        End If
 
        If rating.ID = "RadRating3" Then
 
        End If
        If rating.ID = "RadRating4" Then
 
        End If
 
    End Sub
 
 
    Public Sub AddRating(ByVal rateVal As Object, ByVal picName As String, ByVal picId As Integer)
 
        Dim cnstr2 = New SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString())
        Dim cmd2 = New System.Data.SqlClient.SqlCommand("INSERT INTO Ratings(Rating,CreateDate,name,PicID) VALUES (@rating, @date , @name, @picID)", cnstr2)
        cmd2.CommandType = System.Data.CommandType.Text
        cmd2.Parameters.AddWithValue("@rating", rateVal)
        cmd2.Parameters.AddWithValue("@date", Date.Now)
        cmd2.Parameters.AddWithValue("@name", picName)
        cmd2.Parameters.AddWithValue("@picID", picId)
        'cmd2.Parameters.AddWithValue("@ip", ip)
 
        cnstr2.Open()
 
        cmd2.ExecuteNonQuery()
        cnstr2.Close()
 
    End Sub
 
    Public Function GetCount(ByVal picID As Integer) As Decimal
        Dim theCount As Decimal = 0.0
 
        'Dim currentAverageRating As Object = Vehicles.Rows(dataItem.ItemIndex + RadGrid1.CurrentPageIndex * RadGrid1.PageSize)(2)
        Dim cnstr2 = New SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString())
        Dim rdr As SqlDataReader
        Dim cmd2 = New System.Data.SqlClient.SqlCommand("SELECT AVG(Rating) AS Total FROM Ratings  WHERE PicID = @picID ", cnstr2)
        cmd2.CommandType = System.Data.CommandType.Text
        cmd2.Parameters.AddWithValue("@picID", picID)
        cnstr2.Open()
 
        rdr = cmd2.ExecuteReader
 
        If rdr.HasRows Then
 
            rdr.Read()
            If Not IsDBNull(rdr.GetValue(rdr.GetOrdinal("Total"))) Then
                theCount = rdr.GetValue(rdr.GetOrdinal("Total"))
            End If
        End If
        rdr.Close()
 
        cnstr2.Close()
        Return theCount
    End Function
 
 
    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
 
        RadRating1.DbValue = GetCount(20141)
 
        'Label1.Text = "Your Rating is: " + "<span style='color:Red'>" + RadRating1.Value.ToString + "</span>"
        Label2.Text = "Average Rating is: " + "<span style='color:Red'>" + Convert.ToString(Format(GetCount(20141), "#.#")) + "</span>"
    End Sub
 
 
End Class

And here is the HTML:
<telerik:RadRating ID="RadRating1" Precision="Item" Value="0" ItemCount="5" runat="server" AutoPostBack="true" OnRate="RadRating_Rate">
                        </telerik:RadRating>
                        <asp:Label ID="Label1" runat="server" ForeColor="Green"></asp:Label>
                        <asp:Label ID="Label2" runat="server" ForeColor="Green"></asp:Label>
Ianko
Telerik team
 answered on 24 Dec 2014
7 answers
158 views
When I enter a span tag in the editor content, the DOM inspector shows it as a font tag.

You can see this on the demos. Just clear the content in the editor, go the html view, and type in very simple html like this: <span>hello</span>

Switch to design view and check it in the inspector - it is now called 'font'. The actual html is not changed (it is still a span), but the inspector gets it wrong.

​
Ianko
Telerik team
 answered on 24 Dec 2014
2 answers
57 views
Hi!
When I insert an appointment in advanced form, the start/end time combos have items until 17:30, while I set the business hour to 20:00.

How can I have those combos have items to 20:00?

Thanks!
Mavel
Top achievements
Rank 1
 answered on 24 Dec 2014
1 answer
399 views
Hello all:

I followed the online documentation, but cannot get the RadTabStrip to correctly change the page when clicked. I used a RadTabStrip, Added a MultipageView, and then added page views but nothing changes when I click the tabs. The code is shown below. Note I am using CodeBehind files so need to have the Tab change action in the code behind.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
  <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
    </script>
</telerik:RadCodeBlock>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <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>
    <script type="text/javascript">
        //Put your JavaScript code here.
    </script>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <div style="z-index: 102; left: 0px; width: 800px; position: absolute; top: 0px; height: 1000px">
      <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" OnAjaxRequest="RadAjaxPanel1_AjaxRequest" Height="692px" Width="798px">
        <telerik:RadTabStrip ID="RadTabStrip1" runat="server" SelectedIndex="0">
          <Tabs>
            <telerik:RadTab runat="server" Selected="True" Text="Store Information" PageViewID="RadPageView1">
            </telerik:RadTab>
            <telerik:RadTab runat="server" Text="General Information" PageViewID="RadPageView2">
            </telerik:RadTab>
            <telerik:RadTab runat="server" BackColor="#CCC0DA" Text="Fruits">
            </telerik:RadTab>
            <telerik:RadTab runat="server" BackColor="#C4BD97" Text="Nuts &amp; Ginseng">
            </telerik:RadTab>
            <telerik:RadTab runat="server" BackColor="#C4D79B" Text="Vegetables">
            </telerik:RadTab>
            <telerik:RadTab runat="server" BackColor="#B7DEE8" Text="Fish &amp; Shell Fish">
            </telerik:RadTab>
            <telerik:RadTab runat="server" BackColor="#E6B8B7" Text="Beef &amp; Veal">
            </telerik:RadTab>
          </Tabs>
        </telerik:RadTabStrip>
        <telerik:RadMultiPage ID="RadMultiPage1" runat="server" Height="365px" SelectedIndex="0">
          <telerik:RadPageView ID="RadPageView1" runat="server" Height="360px" Width="787px">
            <asp:Label ID="Label1" runat="server" Font-Bold="True" Text="Store Information"></asp:Label>
            <asp:Label ID="Label2" runat="server" Font-Bold="True" Text="Store Name:"></asp:Label><asp:TextBox ID="txtStoreName" runat="server"></asp:TextBox>
            <asp:Label ID="Label3" runat="server" Font-Bold="True" Text="Store ID Number:"></asp:Label><asp:TextBox ID="txtStoreID" runat="server"></asp:TextBox>
            <asp:Label ID="Label4" runat="server" Font-Bold="True" Text="Corporate Name:"></asp:Label><asp:TextBox ID="txtCorpName" runat="server"></asp:TextBox>
            <asp:Label ID="Label5" runat="server" Font-Bold="True" Text="Store Address:"></asp:Label><asp:TextBox ID="txtAddress1" runat="server"></asp:TextBox>
            <asp:Label ID="Label6" runat="server" Font-Bold="True" Text="City, State, Zip:"></asp:Label><asp:TextBox ID="txtCityStateZip" runat="server"></asp:TextBox>
            <asp:Label ID="Label7" runat="server" Font-Bold="True" Text="Store Phone Number:"></asp:Label><asp:TextBox ID="txtStorePhone" runat="server"></asp:TextBox>
            <asp:Label ID="Label8" runat="server" Font-Bold="True" Text="PACA License #:"></asp:Label><asp:TextBox ID="txtPACA" runat="server"></asp:TextBox>
          </telerik:RadPageView>
          <telerik:RadPageView ID="RadPageView2" runat="server" Height="360px" Width="787px">
          </telerik:RadPageView>
        </telerik:RadMultiPage>
        <asp:TextBox ID="txtDebug" runat="server" style="z-index: 102; left: 6px; width: 400px; position: absolute; top: 548px; height: 400px" TextMode="MultiLine"></asp:TextBox>
            

      </telerik:RadAjaxPanel>


    </div>
    </form>
</body>
</html>

Plamen
Telerik team
 answered on 24 Dec 2014
5 answers
122 views
It's a pity that the GridTemplateColumn doesn't support standard filter editors based on either the DataType or DateField data type (e.g., a DateTime data type is rendered as though it was a GridDateTimeColumn filter editor).  This seems like an easy implementation if <FilterTemplate> is not included but filtering is turned on.  Or another idea would be an alternative to <FilterTemplate> that would turn on the standard filter editor and let you set attributes on that.  I really want the filter button without all the extra work.

But maybe this is a quick way around it?  This is the column in the grid:

<telerik:GridTemplateColumn HeaderText="Expires On" DataType="System.DateTime" Visible="true" ShowFilterIcon="true" ShowSortIcon="true" UniqueName="dpExpDate" DataField="EXPIRATION_DATE" AllowFiltering="true" SortExpression="EXPIRATION_DATE" AllowSorting="true" FilterListOptions="VaryByDataType" >
    <HeaderStyle Width="240px" />
    <ItemStyle Width="240px" />
    <ItemTemplate>
        <asp:Label runat="server" ID="lblExpDate" />
    </ItemTemplate>
    <EditItemTemplate>
        <telerik:RadDateTimePicker runat="server" ID="dpExpDate" Skin="Office2010Blue" Width="220px">
            <DateInput Display="true" DisplayDateFormat="G" DateFormat="G" runat="server" Font-Size="13px" Font-Name="Arial" />
            <TimePopupButton Visible="false" />
        </telerik:RadDateTimePicker><asp:Label runat="server" ID="lblInsertIn" Text="In" />
        <telerik:RadDropDownList runat="server" ID="ddlInsertHours" Font-Names="Arial" Font-Size="13px" Width="80px" Skin="Office2010Blue" />
        <asp:Label runat="server" ID="lblInsertHours" Text="Hours" />
    </EditItemTemplate>
</telerik:GridTemplateColumn>

And here's what I did in grid_ItemCreated:

if (e.Item is GridFilteringItem)
{
    GridFilteringItem item = e.Item as GridFilteringItem;
    if (item["dpExpDate"].Controls[0] is TextBox)
    {
        DateTime value = DateTime.MinValue;
        DateTime.TryParse(gridBatches.MasterTableView.GetColumn("dpExpDate").CurrentFilterValue, out value);
 
        RadDateTimePicker pick = new RadDateTimePicker();
        pick.Width = Unit.Pixel(200);
        pick.DateInput.DateFormat = "G";
        pick.DateInput.DisplayDateFormat = "G";
        pick.TimePopupButton.Visible = false;
        pick.DateInput.Width = Unit.Pixel(180);
        pick.Skin = "Office2010Blue";
        pick.DateInput.Font.Size = FontUnit.Parse("13px");
        pick.DateInput.Font.Name = "Arial";
        if (!value.Equals(DateTime.MinValue)) pick.DbSelectedDate = value;
 
        item["dpExpDate"].Controls.RemoveAt(0);
        item["dpExpDate"].Controls.AddAt(0, pick);
    }
}

Any reason I can't do that?  It seems to filter perfectly and appears to fit in with the Telerik examples that just assume there's always TextBox in Controls[0] anyway.

Feedback?
Kostadin
Telerik team
 answered on 24 Dec 2014
1 answer
89 views
I currently have 3 listboxes - Each one contains a "CustomAttr" attribute.

Listbox1.items["CustomAttr"] = 1
Listbox2.items["CustomAttr"] = 2
Listbox3.items["CustomAttr"] = 3

Destination Listbox = DestinationListBox

So when I drag an item from Listbox 1 to DestinationListBox, the item in DestinationListBox will still maintain ["CustomAttr"] = 1 (I believe)

In the OnClientTransferring client event, is it possible to get a count of items in DestinationListBox by attribute? 

The reason I ask is I want to be able to add only 5 items of ["CustomAttr"]  = 1, and ensure that if that is the case from OnClientTransferring, I can cancel the event using args.set_cancel(true);


If anyone has a better way of carrying out this type of function, I would really appreciate the assistance..

Many thanks,
Laurence
Bozhidar
Telerik team
 answered on 24 Dec 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?