Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
107 views
I'm trying to use the RadMaskedTextBox. What I need to do is to allow the user to enter 3 different formats.

Below are examples

123

123-456

123-456-789


If he enters 132 then there is nothing different but if he types in 1234 then as soon as he enters 4, I need to display the dash. It is the same for 7. I can't use a validator as I need it on the entry and not when he is validating the page.

I thought about using a mask but I don't want to display the dash when the page loads in case he only types in 3 digits. I thought about a regular expression but I don't know how to implement only when the user is typing and not validating.

Maybe the RadMaskedTextBox is not the right control to use.

Thank you for your help.
Elisabeth
Top achievements
Rank 1
 answered on 08 Jan 2013
4 answers
362 views
I have a RadCombobox where in the first name textbox if I type a letter...it shows me list of users that begin with that letter.

<telerik:RadComboBox Visible="false" Skin="Vista" TabIndex="10" ID="rcbLastName" runat="server"
                                                           AllowCustomText="true" Width="200px" ShowToogleImage="false" EnableOverlay="true" ShowDropDownOnTextboxClick="false" DropDownWidth="200px" MaxLength="20" CausesValidation="false"
                                                           EnableLoadOnDemand="true" EnableScreenBoundaryDetection="false" ExpandDirection="Up" EnableVirtualScrolling="true" ShowMoreResultsBox="true"
                                                           AutoPostBack="True" OnClientItemsRequesting="OnClientItemsRequesting" OnClientDropDownOpening="OnClientDropDownOpening" OnItemsRequested="rcbLastName_ItemsRequested" OnSelectedIndexChanged="rcbBarNumber_SelectedIndexChanged"
                                                           ItemsPerRequest="5">

I have server side code rcbFirstName_itemsrequested that pulls the data out of the db and displays it. 
if (!String.IsNullOrEmpty(e.Text))
            {
                rcbLastName.ClearSelection();
                NameValueCollection nvc = new NameValueCollection();
                nvc.Add("LastName", e.Text);
  
                DataTable accounts = DB.ExecuteDataTable("usp_AccountsGetByLastName", nvc);
                int itemOffset = e.NumberOfItems;
                int endOffset = Math.Min(itemOffset + rcbLastName.ItemsPerRequest, accounts.DefaultView.Count);
                e.EndOfItems = endOffset == accounts.DefaultView.Count;
  
                for (int i = itemOffset; i < endOffset && i < accounts.DefaultView.Count; i++)
                {
                    string data = accounts.DefaultView[i]["FullName"].ToString();
                    if (!String.IsNullOrEmpty(accounts.DefaultView[i]["Address1"].ToString()))
                    {
                        data += " - " + accounts.DefaultView[i]["Address1"].ToString() + " ";
                        if (!String.IsNullOrEmpty(accounts.DefaultView[i]["Address2"].ToString()))
                            data += accounts.DefaultView[i]["Address2"].ToString() + " ";
                        data += accounts.DefaultView[i]["City"].ToString() + " " + accounts.DefaultView[i]["State"].ToString() + " " + accounts.DefaultView[i]["Zip"].ToString();
                    }
                    rcbLastName.Items.Add(new RadComboBoxItem(data, accounts.DefaultView[i]["AccountID"].ToString()));
                }
                if (accounts.DefaultView.Count <= 0)
                    e.Message = "No matches";
                else
                    e.Message = String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset, accounts.DefaultView.Count);
            }

The drop down is working fine. However I do not understand how to get rid of the empty Combo box item if there are no matches. Also, how to get rid of the down arrow if there are no matches. 

What do I need to do if I don't want to show the drop down if there are no matches.

Please advice!

Thanks!
Nencho
Telerik team
 answered on 08 Jan 2013
4 answers
281 views
Hi,

I'm evaluating Telerik RadGrid for our web portal software and therefore created a few prototypes. There is one behavior that strikes me: In a grid configured to allow multiple selections (using GridClientSelectColumn), after deselecting the last item of formerly selected items, the grid's SelectedIndexChanged event doesn't fire on the next postback. Every other change regarding the selection raises the event as anticipated. Is this by design? And if it is, how can I get notified about the selection change?

Thanks,

Andreas
Andreas
Top achievements
Rank 1
 answered on 08 Jan 2013
3 answers
132 views
Happy New Year

I have a RadGrid and RadTreeview controls on a web form. Treeview displays list of documents which user can drop on RadGrid rows. I change the text of one of columns in grid from "Drop Here" to document dropped from the treeview using server side code. 

I would like to place a validation using client side to stop user dropping another document on the same row. To achieve this I was checking for text "Drop Here" in the column where document was dropped and allow if the text is "Drop Here". I always get the text "Drop Here" although the text has been updated.

My ASPX and code behind are as below

Many thanks
GridDataItem dataItem = RadGrid1.MasterTableView.Items[RowNumber.Value];
 
foreach (RadTreeNode node in e.DraggedNodes)
{
    //AddRowToGrid(dt, node);
    dataItem["DocAssigned"].Text = node.Text;
}

<telerik:RadDockZone runat="server" ID="RadDockZone1" Orientation="Vertical" Height="300px" Width="875px" BorderStyle="None">
    <telerik:RadDock runat="server" ID="RadDock1" Title="Vehicle Schedule" Height="300px" Width="875px">
        <ContentTemplate>
            <telerik:RadGrid runat="server" ID="RadGrid1" Width="840px" Visible="true" AutoGenerateColumns="False" OnRowDrop="RadGrid1_RowDrop">
                <MasterTableView Width="100%" DataKeyNames="CompletionDate,DocAssigned"  ClientDataKeyNames="CompletionDate,DocAssigned">
                    <Columns>
                        <telerik:GridBoundColumn
                            UniqueName="CompletionDate" SortExpression="CompletionDate" DataField="CompletionDate"
                            HeaderStyle-Width="85" HeaderText="Completed" DataFormatString="{0:dd/MM/yyyy}">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn
                            UniqueName="DateDue" SortExpression="DateDue" DataField="DateDue"
                            HeaderStyle-Width="85" HeaderText="Due" DataFormatString="{0:dd/MM/yyyy}">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn
                            UniqueName="AgCompanyName" SortExpression="AgCompanyName" DataField="AgCompanyName"
                            HeaderStyle-Width="250" HeaderText="Agent">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn
                            UniqueName="DocName" SortExpression="DocName" DataField="DocName"
                            HeaderStyle-Width="150" HeaderText="Document">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn
                            UniqueName="LinkedTo" SortExpression="LinkedTo" DataField="LinkedTo"
                            HeaderStyle-Width="80" HeaderText="Linked To">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderStyle-Width="80" HeaderText="Doc Assigned" UniqueName="DocAssigned" SortExpression="DocAssigned" DataField="DocAssigned" >
                        </telerik:GridBoundColumn>
                    </Columns>
                    <NoRecordsTemplate>
                        <div style="height: 30px; cursor: pointer;">
                            No outstanding documents for this vehicle
                        </div>
                    </NoRecordsTemplate>
                </MasterTableView>
                <ClientSettings AllowRowsDragDrop="true">
                    <ClientEvents OnRowMouseOver="RowMouseOver" OnRowDragStarted="OnRowDragStarted" />
                    <Selecting AllowRowSelect="True" EnableDragToSelectRows="false" />
                </ClientSettings>
            </telerik:RadGrid>
        </ContentTemplate>
    </telerik:RadDock>
</telerik:RadDockZone>
<telerik:RadDockZone runat="server" ID="unprocessedDocumentsRadDockZone" Orientation="Vertical" Height="460px" Width="875px" BorderStyle="None">
    <telerik:RadDock runat="server" ID="unprocessedDocumentsRadDock" Title="Unprocessed Documents" Height="460px" Width="875px">
        <ContentTemplate>
            <table>
                <tr>
                    <td valign="top">
                        <telerik:RadTreeView ID="RadTreeView1" runat="server" AllowNodeEditing="false"  Height="400px" Width="200px" Style="border: 1px solid #CBE7F5;"
                                             EnableDragAndDrop="true"  OnClientNodeClicked="onNodeClicked"
                                             OnNodeDrop="RadTreeView1_HandleDrop"
                                             OnClientNodeDropping="onNodeDropping" OnClientNodeDragging="onTreeViewDragging"
                                             OnNodeExpand="RadTreeView1_NodeExpand">
                        </telerik:RadTreeView>
                     
                    </td>
                    <td valign="top">
                        <pdfviewer:ShowPdf ID="ShowPdf1" runat="server" BorderStyle="None" BorderWidth="0px" Height="400px" Width="680px" />
                     
                    </td>
                </tr>
            </table>
        </ContentTemplate>
    </telerik:RadDock>
</telerik:RadDockZone>
Neetu
Top achievements
Rank 1
 answered on 08 Jan 2013
1 answer
82 views
I have implemented a radGrid with a GridDateTimeColumn as follows:
<telerik:RadGrid ID="radGridHistory" AllowCustomPaging="True" AllowFilteringByColumn="True"
    AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" EnableHeaderContextMenu="true"
    EnableLinqExpressions="False" GridLines="Horizontal" GroupingEnabled="false"
    Visible="false"
    OnItemDataBound="radGridHistory_ItemDataBound" OnInit="radGridHistory_Init" OnNeedDataSource="radGridHistory_NeedDataSource"
    runat="server">
    <GroupingSettings CaseSensitive="false" />
    <MasterTableView DataKeyNames="ID" AllowFilteringByColumn="true" AllowCustomSorting="true" NoMasterRecordsText="No History records to display">
        <Columns>
 
            <telerik:GridDateTimeColumn DataField="EventDate" DataFormatString="{0:MM/dd/yyyy hh:mm tt}"
                EnableRangeFiltering="true" EnableTimeIndependentFiltering="false"
                HeaderText="Date" PickerType="DatePicker" SortExpression="EventDate"
                UniqueName="EventDate">
            </telerik:GridDateTimeColumn>
 
        </Columns>
        <PagerStyle AlwaysVisible="True" />
    </MasterTableView>
    <ClientSettings>
        <Scrolling AllowScroll="true" UseStaticHeaders="true" />
    </ClientSettings>
    <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true" />
    <FilterMenu EnableImageSprites="false" />
</telerik:RadGrid>


The filter popup though is missing the "NoFilter", "Between" and "NotBetween" options as shown in the attached jpg.  What am I missing here?  I am running Telerik ASP.NET AJAX version 2012.3.1205.40.
Chad Johnson
Top achievements
Rank 1
 answered on 08 Jan 2013
1 answer
101 views


On page load i bind data to the combobox control but if the user selects the ShowMoreResults arrow
 down button 
to load more items(even though i display all items) it appends the same amount of items
 to the box without clearing the original binded items. even though when the rcboSearch_ItemsRequested is launched it is set to clear the combobox and
indeed stepping through the code it says it has the output on screen is that
the page load data is mixed with the new data.


note if the user starts to type into the combobox the results get cleared.
the problem is only when i append data on page load and select ShowMoreResults
arrow which seems to be present even though 
there shouldnt be any more results to load,
 this triggers 
rcboSearch_ItemsRequested and adds the same amount of data
 as page load to the data already there







<telerik:RadComboBox runat="server" ID="ComboAllContacts"  Width="300"
                ShowMoreResultsBox="true" MaxLength="250" EnableVirtualScrolling="true" EnableLoadOnDemand="true"
                EmptyMessage="Select Area" MarkFirstMatch="false" AllowCustomText="false" HighlightTemplatedItems="false"
                EnableItemCaching="false" MinFilterLength="1" CssClass="fx-areaselector"  OnItemsRequested="rcboSearch_ItemsRequested"
                skin="Fluent" EnableEmbeddedSkins="false" DataValueField="CRMAreaID" ClientIDMode="Static" >
 
     <ItemTemplate>
           <div class="searchResult">
           <div class="profilePicContainer">
          <a  title="View <%# DataBinder.Eval(Container, "Attributes['Name']")%>"><%# DataBinder.Eval(Container,        "Attributes['Name']")%></a>  
         </div>
         </div>
           <div class="separatorTemplate" style="display: none;">
            <h2><%#DataBinder.Eval(Container, "Attributes['Name']")%></h2>
           </div>
       </ItemTemplate>
</telerik:RadComboBox>



<<< Page Load >>>

If Not IsPostBack Then
            Dim currentRowType = String.Empty
 
            Dim ds As DataSet = AreaHelper.GetMyAreas()
            Dim dt As DataTable = ds.Tables(0)
 
 
            ComboAllContacts.DataValueField = "CRMAreaID"
 
            For Each row As DataRow In dt.Rows
 
                Dim item As New RadComboBoxItem
                Dim CRMAreaID As String = row("CRMAreaID").ToString()
                Dim Name As String = row("Name").ToString()
                Dim Region As String = row("Region").ToString()
 
                If currentRowType <> Region Then
                    ' Add separator Row
                    ComboAllContacts.Items.Add(CreateSeparatorItem(Region))
                    currentRowType = Region
                End If
 
 
                item.Value = CRMAreaID.ToString()
                item.Text = Name
 
                item.Attributes.Add("CRMAreaID", CRMAreaID)
                item.Attributes.Add("Region", Region)
                item.Attributes.Add("Name", Name)
                item.Attributes.Add("IsSeparator", False)
                item.Attributes.Add("onclick", "NavigateAreaSelection(" + CRMAreaID + ")")
 
                If Not String.IsNullOrWhiteSpace(item.Text) Then
                    ComboAllContacts.Items.Add(item)
                End If
            Next row
 
 
            ComboAllContacts.DataBind()
 
        End If



<<<ItemsRequested>>>

Protected Sub Protected Sub rcboSearch_ItemsRequested(ByVal sender As Object, ByVal e As RadComboBoxItemsRequestedEventArgs)
 
        '' RadComboBox combo = this.FindControl("combo") as RadComboBox;
        ComboAllContacts.ClearSelection()
        ComboAllContacts.Items.Clear()
        ComboAllContacts.Dispose()
        ComboAllContacts.Text = ""
 
 
 
 
        Dim data As DataTable = GetData(e.Text)
 
        Dim itemOffset As Integer = e.NumberOfItems
        Dim endOffset As Integer = data.Rows.Count ''Math.Min(itemOffset + ItemsPerRequest, data.Rows.Count)
        e.EndOfItems = endOffset = data.Rows.Count
 
        'If data.Rows.Count > 0 Then
 
        'End If
 
        Dim currentRowType = String.Empty
 
 
        ''For i As Integer = itemOffset To endOffset - 1
        For Each row As DataRow In data.Rows
 
            Dim item As New RadComboBoxItem
            'Dim CRMAreaID As String = data.Rows(i)("RowID").ToString()
            'Dim rowName As String = data.Rows(i)("Name").ToString()
            'Dim Region As String = data.Rows(i)("Region").ToString()
 
            Dim CRMAreaID As String = row("RowID").ToString()
            Dim rowName As String = row("Name").ToString()
            Dim Region As String = row("Region").ToString()
 
            If currentRowType <> Region Then
                ' Add separator Row
                ComboAllContacts.Items.Add(CreateSeparatorItem(Region))
                currentRowType = Region
            End If
 
 
            item.Value = CRMAreaID
            item.Text = rowName
 
            item.Attributes.Add("CRMAreaID", CRMAreaID)
            item.Attributes.Add("Region", Region)
            item.Attributes.Add("Name", rowName)
            item.Attributes.Add("IsSeparator", False)
            item.Attributes.Add("onclick", "NavigateAreaSelection(" + CRMAreaID + ")")
 
            If Not String.IsNullOrWhiteSpace(item.Text) Then
                ComboAllContacts.Items.Add(item)
            End If
            ''Next row
        Next
 
 
 
        If ComboAllContacts.Items.Count > 0 Then
            ComboAllContacts.DataBind()
        Else
 
        End If
        e.Message = GetStatusMessage(endOffset, ComboAllContacts.Items.Count)(ByVal sender As Object, ByVal e As RadComboBoxItemsRequestedEventArgs)
 
        '' RadComboBox combo = this.FindControl("combo") as RadComboBox;
        ComboAllContacts.ClearSelection()
        ComboAllContacts.Items.Clear()
        ComboAllContacts.Dispose()
        ComboAllContacts.Text = ""
 
 
 
 
        Dim data As DataTable = GetData(e.Text)
 
        Dim itemOffset As Integer = e.NumberOfItems
        Dim endOffset As Integer = data.Rows.Count ''Math.Min(itemOffset + ItemsPerRequest, data.Rows.Count)
        e.EndOfItems = endOffset = data.Rows.Count
 
        'If data.Rows.Count > 0 Then
 
        'End If
 
        Dim currentRowType = String.Empty
 
 
        ''For i As Integer = itemOffset To endOffset - 1
        For Each row As DataRow In data.Rows
 
            Dim item As New RadComboBoxItem
            'Dim CRMAreaID As String = data.Rows(i)("RowID").ToString()
            'Dim rowName As String = data.Rows(i)("Name").ToString()
            'Dim Region As String = data.Rows(i)("Region").ToString()
 
            Dim CRMAreaID As String = row("RowID").ToString()
            Dim rowName As String = row("Name").ToString()
            Dim Region As String = row("Region").ToString()
 
            If currentRowType <> Region Then
                ' Add separator Row
                ComboAllContacts.Items.Add(CreateSeparatorItem(Region))
                currentRowType = Region
            End If
 
 
            item.Value = CRMAreaID
            item.Text = rowName
 
            item.Attributes.Add("CRMAreaID", CRMAreaID)
            item.Attributes.Add("Region", Region)
            item.Attributes.Add("Name", rowName)
            item.Attributes.Add("IsSeparator", False)
            item.Attributes.Add("onclick", "NavigateAreaSelection(" + CRMAreaID + ")")
 
            If Not String.IsNullOrWhiteSpace(item.Text) Then
                ComboAllContacts.Items.Add(item)
            End If
            ''Next row
        Next
 
 
 
        If ComboAllContacts.Items.Count > 0 Then
            ComboAllContacts.DataBind()
        Else
        End If
        e.Message = GetStatusMessage(endOffset, ComboAllContacts.Items.Count)



Nencho
Telerik team
 answered on 08 Jan 2013
2 answers
283 views
hi, is there a way to simulate a treenode click event from the client side (from javascript)?

e.g. I can do the following in the javascript on the client side:

var treeView = $find("<%=RadTreeView1.ClientID%>");

var selectedNode = treeView.get_selectedNode();

alert(selectedNode.get_text());

selectedNode.expand();


Is there a way to fire a node click event from the javascript?

Thanks,
dbi
Sawyer
Top achievements
Rank 1
 answered on 08 Jan 2013
2 answers
135 views
I've done this in a desktop project, but I can't for the life of me figure out how to do this in webforms?
I have data unioned together so it can be displayed in a pivot grid

Date     | Property | Value

1/1/13   | AAA        | 74
1/1/13   | BBB       | 62
2/1/13   | AAA        | 42
2/1/13   | BBB       | 12
2/1/13   | CCC       | 14
3/1/13   | AAA       | 16
x            | series    | y
Which works fine, I was hoping to display this in the chart, so that we can allow users to alter the graph live based on the pivot grid.

I tried HighCharts but I'd have to run multiple queries to try and separate out x-axis and then the series,
RadCharts is the only way I've been able to display the data in a chart thus far, but the amount of data means that the chart is so small its pointless.

Forgive the obfuscation, you can't tell much from the graph anyway but has to be done!


Gareth
Top achievements
Rank 1
 answered on 08 Jan 2013
2 answers
84 views
How can I keep the date header in TimelineView fixed?  i.e. so that it doesn't scroll vertically with the content.

When there are many rows, you scroll down and the header disappears so then you can't see the dates for each column.
Marbry
Top achievements
Rank 1
 answered on 08 Jan 2013
1 answer
72 views
how can i filter a radgrid using a radcombobox?
Shinu
Top achievements
Rank 2
 answered on 08 Jan 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
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?