Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
225 views

Hi

Using a Multicolumn Combobox with OpenAccess and trying to insert a blank item - as need to
 have the option of not selecting any item from the list - tried various solutions/posts with no success - code for combobox as below

 

<telerik:RadComboBox runat="server" ID="RadComboBox1" Height="190px" Width="100%"
 
    MarkFirstMatch="true" DataSourceID="OpenAccessLinqDataSource1" EnableLoadOnDemand="true"
 
    HighlightTemplatedItems="true" DataValueField="PartID" DataTextField="PartNumber"
 
    AppendDataBoundItems="True" SelectedValue='<%# Bind("PartID") %>' ItemsPerRequest="10"
 
    EnableVirtualScrolling="True" Filter="Contains" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged"
 
    AutoPostBack="True">
 
    <HeaderTemplate>
 
        <ul>
 
            <li class="col1">Part Number</li>
 
            <li class="col2">Part Description</li>
 
        </ul>
 
    </HeaderTemplate>
 
    <ItemTemplate>
 
        <ul>
 
            <li class="col1">
 
                <%# DataBinder.Eval(Container.DataItem, "PartNumber")%>
 
            </li>
 
            <li class="col2">
 
                <%# DataBinder.Eval(Container.DataItem, "PartDescription")%></li>
 
        </ul>
 
    </ItemTemplate>
 
</telerik:RadComboBox>

Tried online demo http://www.telerik.com/help/aspnet-ajax/combobox-insert-default-item-when-databinding.html 

 Thanks

 

Calsh
Top achievements
Rank 1
 answered on 29 Oct 2013
10 answers
217 views
When testing our new web site in Chrome we found that the EmptyMessage is not clearing when the field is auto filled with information. We have an email field and a password field on a profile page and these fields are being auto filled. The problem is that the EmptyMessage in each of these fields are not cleared.

Server:
Windows 2008 R2
IIS7.5

Site:
.Net 4.5
Telerik.Web.UI 2012.3.1016.45

Environment:
Windows 8
Chrome 23.0.1271.64
Andrew
Top achievements
Rank 1
 answered on 29 Oct 2013
1 answer
97 views
Dear Telerik,
I am using Declarative client-side data-binding for RadGrid with WCF Data Service.
I want to apply an initial filter on data, I know that radgrid filters add "$filter" to the DataService>TableName so if I do TableName="TableName?$filter=ID eq 1" when I apply a grid filter I will have two $filter keyword in the url or i want one $filter and an "and" keyword ..
ex:TableName?$filter=ID eq 1 and name eq 'jhon'

Please don't tell me to use Programmatic Binding because it's time consuming and require a lot of code

Thank you in advance
Tarek


Maria Ilieva
Telerik team
 answered on 29 Oct 2013
1 answer
108 views
I just upgraded to the latest greatest 2013 Q3 build and I noticed that the grid in lightweight rendering mode does not render any styles.

I attached a couple of screen shots comparing default to lightweight.
Viktor Tachev
Telerik team
 answered on 29 Oct 2013
5 answers
170 views
The documentation claims that this can be done with the set_width() method on the client side.

However, in order to call this method, you need a reference to the TileList.  According to the documentation, this is done via $telerik.findTileList(id, parent) where id is a string representation of the id and parent is the element containg the tilelist.

So, assuming the following document structure...

<body>
    <form id="form">
        <div id="tiles">
            <div id="centering">
                <telerirk RadTileList ID="NavTiles"></telerik:RadTileList>
            </div>
        </div>
    </form>
</body>


... what is the correct javascript to set the width of the TileList to 900px?  I can't make this work, because no matter what I pass to findTileList I always get null back.
Stanimir
Telerik team
 answered on 29 Oct 2013
5 answers
339 views
Hi,

In Google chrome browser, when user increases grid column size on client side, grid does not re size so it does not show right columns and it does not show horizontal scroll bar as well. I use Telerik.Web.UI.dll released on 02-Apr-2013 version 2013.1.403.35. 

HTML page code.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
    <script type="text/javascript">
        //$(document).ready(SetObject);
        $(window).resize(SetRADGrid);
        function SetRADGrid() {
            var grid = document.getElementById(rdgrdGenericReportClientID);
            var windowHeight = $(window).height();
            var windowWidth = $(window).width();
            var gridHeight = 0;
            var contentPageHeight = 510;
            var pageHeaderAndFooter = 125;
            var gridHeader = 75;
            gridHeight = windowHeight - pageHeaderAndFooter < contentPageHeight ? contentPageHeight - gridHeader : windowHeight - gridHeader - pageHeaderAndFooter;
            grid.style.height = gridHeight + "px";
            var webSiteWidth = 1024;
            var submenuWidth = 231;
            var gridWidth = windowWidth < webSiteWidth ? webSiteWidth - submenuWidth : windowWidth - submenuWidth;
            grid.style.width = gridWidth+ "px";
            //grid.repaint();
        }
        function GridCreating(sender, eventArgs) {
            SetRADGrid();
        }
        function ColumnResized(sender, eventArgs) {
            //alert('hi');
            SetRADGrid();
        }       
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <div>
    <telerik:RadGrid ID="rdgrdGenericReport" AllowSorting="True" runat="server" GridLines="None"
        AllowPaging="True" PageSize="25"
        AllowFilteringByColumn="True" OnNeedDataSource="rdgrdGenericReport_NeedDataSource"
        OnColumnCreated="rdgrdGenericReport_ColumnCreated" ShowGroupPanel="True"
        EnableLinqExpressions="False" EnableTheming="false" Style="overflow: hidden;
        position: relative">
        <GroupHeaderItemStyle Font-Bold="True" />
        <ClientSettings Resizing-AllowColumnResize="true" AllowDragToGroup="True">
            <Resizing AllowColumnResize="True" ResizeGridOnColumnResize="true"></Resizing>
            <Scrolling AllowScroll="true" />
            <ClientEvents OnGridCreating="SetRADGrid" OnColumnResized="SetRADGrid" />
        </ClientSettings>
        <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true">
        </ExportSettings>
        <MasterTableView ShowHeader="true" BorderStyle="None" CommandItemDisplay="Top" TableLayout="Fixed">
            <HeaderStyle Font-Bold="true"></HeaderStyle>
            <FooterStyle HorizontalAlign="right"></FooterStyle>
            <CommandItemTemplate/>
        </MasterTableView>
        <PagerStyle Mode="NextPrevAndNumeric" />
    </telerik:RadGrid>   
    </div>
    </form>
</body>
</html>

Code behind 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.ClientScript.RegisterStartupScript(this.GetType(), "RADGrid", string.Format("rdgrdGenericReportClientID='{0}';", rdgrdGenericReport.ClientID), true);
    }
    protected void rdgrdGenericReport_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
    {
        BO bo = new BO();
        rdgrdGenericReport.DataSource = bo.GetStudent();
    }
    protected void rdgrdGenericReport_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
    {
        e.Column.HeaderStyle.Width = Unit.Pixel(100);
    }
}
public class BO
{
    public List<Student> GetStudent()
    {
        List<Student> students = new List<Student>();
        for (int counter = 1; counter <= 45; counter++)
        {
            students.Add(new Student(counter.ToString(),
                string.Format("Student({0})", counter),
                string.Format("Class Name A{0}", counter),
                string.Format("Marks 10{0}", counter),
                string.Format("Student Rank is {0}", counter)
                ));
        }
        return students;
    }
}
public class Student
{
    public Student(string id, string name, string className, string marks, string rank)
    {
        ID = id;
        Name = name;
        ClassName = className;
        Marks = marks;
        Rank = rank;
 
    }
    public string ID { get; set; }
    public string Name { get; set; }
    public string ClassName { get; set; }
    public string Marks { get; set; }
    public string Rank { get; set; }
}

Please find attached same sample code without telerik dll.
Venelin
Telerik team
 answered on 29 Oct 2013
8 answers
226 views
Hello Support,

I am experiencing an issue with the Telerik Grid where I'm trying to delete a customer using
gvCustomers_DeleteCommand(object sender, GridCommandEventArgs e)and the incorrect Customer ID
is being passed. I believe this is happening because of paging is enabled.

What am I doing wrong?  Thanks for your help in advance.

See code below:

<
telerik:RadGrid ID="gvCustomers" runat="server"
        AllowPaging="true"
        AllowSorting="true"
        AllowAutomaticDeletes="true"
        AutoGenerateColumns="false"
        PageSize="10"
        DataKeyNames="CustomerId"
        OnItemCreated="gvCustomers_ItemCreated"
        OnItemCommand="gvCustomers_ItemCommand"
        OnItemDeleted="gvCustomers_ItemDeleted"
        OnDeleteCommand="gvCustomers_DeleteCommand"
        OnNeedDataSource="gvCustomers_NeedDataSource">
 
        <ClientSettings EnableRowHoverStyle="true" EnableAlternatingItems="true">
            <Selecting AllowRowSelect="true" />
            <ClientEvents OnRowDblClick="RowDblClick" />
        </ClientSettings>
 
        <ExportSettings HideStructureColumns="true" ExportOnlyData="true" />
 
        <MasterTableView AutoGenerateColumns="false" DataKeyNames="CustomerId"
            ClientDataKeyNames="CustomerId" CommandItemDisplay="Top">
            <CommandItemSettings
                ShowAddNewRecordButton="false"
                ShowExportToCsvButton="true"
                ShowRefreshButton="false" />
            <Columns>
 
                <telerik:GridTemplateColumn HeaderText="Edit" UniqueName="EditCustomer">
                    <ItemTemplate>
                        <asp:HyperLink ID="hlEditCustomer" runat="server" ToolTip="Update Customer Record" Text="Edit" ImageUrl="images/glyphicons_halflings_060_pencil.png" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
 
                <telerik:GridTemplateColumn HeaderText="Transactions" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" UniqueName="CustomerTransactions">
                    <ItemTemplate>
                        <asp:HyperLink ID="hlTransactions" runat="server" ToolTip="Customer Transactions" ImageUrl="~/images/glyphicons_halflings_031_list-alt.png" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
 
                <telerik:GridTemplateColumn HeaderText="New Sale" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" UniqueName="CustomerSales">
                    <ItemTemplate>
                        <asp:HyperLink ID="hlNewSale" runat="server" ToolTip="New Customer Sale" ImageUrl="~/images/glyphicons_halflings_147_usd.png" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
 
                <telerik:GridBoundColumn DataField="CustomerId" HeaderText="Customer ID" SortExpression="CustomerId" />
                <telerik:GridBoundColumn DataField="LastName" HeaderText="Last Name" SortExpression="LastName" />
                <telerik:GridBoundColumn DataField="FirstName" HeaderText="First Name" SortExpression="FirstName" />
                <telerik:GridBoundColumn DataField="Organization" HeaderText="Organization" SortExpression="Organization" />
                <telerik:GridBoundColumn DataField="Address1" HeaderText="Address" SortExpression="Address1" />
                <telerik:GridBoundColumn DataField="Address2" HeaderText="Address 2" SortExpression="Address2" Visible="false" />
                <telerik:GridBoundColumn DataField="City" HeaderText="City" SortExpression="City" />
                <telerik:GridBoundColumn DataField="State" HeaderText="State" SortExpression="State" />
                <telerik:GridBoundColumn DataField="PostalCode" HeaderText="PostalCode" SortExpression="PostalCode" />
 
                <telerik:GridButtonColumn
                    UniqueName="DeleteCustomer"
                    ConfirmText="Are you sure you want to delete this customer?"
                    ConfirmDialogType="Classic"
                    ConfirmTitle="Delete"
                    ButtonType="ImageButton"
                    CommandName="Delete"
                    CommandArgument="CustomerId"
                    HeaderText="Delete"
                    HeaderStyle-Width="20"
                    HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-HorizontalAlign="Center"
                    ImageUrl="~/images/glyphicons_halflings_019_trash.png" />
            </Columns>
        </MasterTableView>
 </telerik:RadGrid>
  
protected void gvCustomers_DeleteCommand(object sender, GridCommandEventArgs e)
{
        var item = (GridDataItem)e.Item;

           // This is return the incorrect CustomerId because of paging.
        var id = item.GetDataKeyValue("CustomerId").ToString();
 
        var customer = new Customer(id);
        customer.Delete();
 
        ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind();", true);
 
        // Click the Search button
        btnSearch_Click(sender, e);
        //e.Item.OwnerTableView.ParentItem.OwnerTableView.Rebind();
 }
Jayesh Goyani
Top achievements
Rank 2
 answered on 29 Oct 2013
1 answer
125 views
Hello,

I have a problem with shortcut to open a URL (It's not mainly related to Telerik web UI, but it could help)

The scenario is 
I have a website developed by Telerik AJAX web control, On the client side (User PC) I create a shortcut (contains URL) on desktop to facilitate opining the site.
Suppose I'm using CHROME browser, I need to control opening the website (Single instance of the web site opened) means that, First time when user click on desktop shortcut it fires the browser (for example chrome) then open the website, second time or others time when user click on desktop shortcut (same shortcut) to open the website, It should retrieve the opened one if it opened before, If not then open a new instance (new browser tab) 


Is there any argument can pass it to chrome or any way to satisfy this issue ?!
Rumen
Telerik team
 answered on 29 Oct 2013
4 answers
189 views

I have a RadAsyncUpload control in a RadWindow, but can't get it to save the file.  I previously had the same upload control dynamically added on the page (outside the window) and it was working fine.  Can someone help me with this?

 

First of all, I have a RadWindow defined:

<telerik:RadWindow ID="winUploadImage" runat="server" VisibleOnPageLoad="false" OnClientShow="windowLoad"
    VisibleStatusbar="false" AutoSize="false" Width="451" Height="275">
    <ContentTemplate>
    </ContentTemplate>
</telerik:RadWindow>

 

 

Next, I have a dynamically created RadAsyncUpload Control that is created and added to the window:

protected void BtnUpload_Click(object sender, EventArgs e)
    {
        winUploadImage.ContentContainer.Controls.Add(new LiteralControl("<div class=\"quotebox\"><table class=\"quotetext\"><tr><td colspan=\"2\" class=\"quotetext\">"
               + "</td></tr><tr><td class=\"quotetext\">Do you want to use a previously uploaded image?" + "</td>"
               + "</tr>"
               + "</table></div>"
               ));
 
        RadButton clickedButton = new RadButton();
        clickedButton = (RadButton)sender;
 
        RadAsyncUpload upload = new RadAsyncUpload();
        upload.ID = "rauChoice";
        upload.Attributes.Add("runat", "server");
        upload.Attributes.Add("type", clickedButton.Attributes["type"]);
        upload.Attributes.Add("subtype", clickedButton.Attributes["subtype"]);
        //upload.Height = Unit.Parse("86px");
        //upload.Width = Unit.Parse("1px");
        upload.TargetFolder = "~/App_Images/uploads";
        upload.TemporaryFolder = "~/App_Data/RadUploadTemp";
        upload.FileUploaded += new FileUploadedEventHandler(ChangeFilename);
        upload.OnClientFileUploading = "uploading_file";
        upload.MaxFileInputsCount = 1;
        upload.MaxFileSize = 5000000; // 5 MB
        winUploadImage.ContentContainer.Controls.Add(imgAdd);
        winUploadImage.ContentContainer.Controls.Add(upload);
 
        winUploadImage.Modal = false;
        winUploadImage.Behaviors = Telerik.Web.UI.WindowBehaviors.Close;
        //winUploadImage.Top = 650;
        //winUploadImage.Left = 825;
        winUploadImage.OffsetElementID = divOptions.ClientID;
        winUploadImage.Top = 40;
        winUploadImage.Left = -25;
        winUploadImage.VisibleOnPageLoad = true;
    }


When the files is uploaded, it should call this function

protected void ChangeFilename(object sender, FileUploadedEventArgs e)
    {
        try
        {
            RadAsyncUpload uploadMod = new RadAsyncUpload();
            uploadMod = (RadAsyncUpload)sender;
            string targetFolder = uploadMod.TargetFolder;
 
            string newName =
                      uploadMod.Attributes["type"] + "!"
                    + uploadMod.Attributes["subtype"] + "!"
                    + DateTime.Now.ToString("yyyyMMddHHmmssfff")
                    ;
 
            Session[uploadMod.ID] = newName + e.File.GetExtension();
 
            e.File.SaveAs(Path.Combine(Server.MapPath(targetFolder), newName + e.File.GetExtension()));
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }


When a button inside the window is pressed, the page posts back, but the file is not uploaded (it is not saved in the target folder and the ChangeFilename funtion is not called).

How can I get the file to upload correctly?

 

 

 

Troy
Top achievements
Rank 1
 answered on 29 Oct 2013
1 answer
119 views
Hi,
we have a RadGrid control which has custom paging enabled. The maximum page size is equal to 50 records.
When the selected page size is equal to 30 records, the DataBind takes about 3 seconds to complete and the time is increased when page size increases.

Each GridTemplateColumn consists of a literal control which value is set in the DataBind event (see the code below).

 

 

<custom:RequestUrgency DataField="SolverUrgencyId" Groupable="false" FilterControlWidth="180px" HeaderText="Αμεσότητα" UniqueName="RequestSolverUrgency">

 <headerstyle width="15%" />

<ItemTemplate>

<asp:Literal ID="litSolverUrgencyId" runat="server" Text='<%# Eval("SolverUrgencyId") %>'>

 </asp:Literal>

</ItemTemplate>

 </custom:RequestUrgency>

 



The value of the literal changes to the DataBind event as below

 

 

protected void gridRequests_ItemDataBound(object sender, GridItemEventArgs e)

 

{

    try

    {

 

 

        if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)

       {
            #region Urgency

 

 

 

            Literal litSolverUrgencyId = (Literal)e.Item.FindControl("litSolverUrgencyId");

 

            dt = DAL.GetServiceRequestUrgency(request.SolverUrgencyId);

 

            litSolverUrgencyId.Text = dt.Rows[0]["Title"].ToString(); 
 

            #endregion

 

        }

 

// if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)

 

    }

    catch
    {
    }
}

The RadGrid consists of 24 columns.
How can we reduce the DataBind time??

Thank you very much,
Angie
Viktor Tachev
Telerik team
 answered on 29 Oct 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?