Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
1.2K+ views
Hi,
i have a rad grid that for some reason will not show the scrollbars when the grid is full size.
The grid is nested inside a pageview which is 500px wide.
the grid itself is 493px wide.

now if i reduce the grid size down to 350px then the scrollbar shows up. however anything over that it disappears.
I've tried changing all the values of the pageview size and grid size etc but nothing seem to work.

Anyone know how to fix this?

Tuhiram
Top achievements
Rank 1
 answered on 16 Feb 2019
7 answers
369 views
I have telerik:2RadTimePicker controls with in grid and I want to get the time using javascript. 

one is Start Time other one is  End Time i have to check the Validation  is Start Time Could be > End Time .

Is there any possibility to do this one on when user enter the End Time it will check the validation and throw a error with alert message,

and how to get time form time picker using javascript and do the validations and i want to show the timepicker with redcolor where the time validation is false 


Any Suggestions.,

Regards 

SR.
Attila Antal
Telerik team
 answered on 15 Feb 2019
4 answers
155 views

Hi,
    I have a weird issue with rad listbox filtering. I tried to attach that, but the post didn't allowed me to. I will write the code here.

<form id="form1" runat="server">
    <div>
        <telerik:RadScriptManager ID="script1" runat="server"></telerik:RadScriptManager>
        <asp:Panel ID="pnlMainFields" runat="server">
                <table>
                    <tr>
                        <td>
                            <table>
                                <tr>
                                    <td>
                                        <h3>Available Fields</h3>
                                        <table>
                                            <tr>
                                                <td>
                                                    <asp:CheckBox ID="chkShowAdvanced" runat="server" Text="Show advanced columns" AutoPostBack="true" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <telerik:RadTextBox ID="tbAvailableFilter" runat="server"
                                                        Width="187px"
                                                        EmptyMessage="Search ..."
                                                        autocomplete="off"
                                                        onkeyup="filterList();" />
                                                    <telerik:RadButton ID="rbtnClear" runat="server"
                                                        Width="22px"
                                                        AutoPostBack="false"
                                                        OnClientClicking="rbtnClear_OnClientClicking">
                                                        <Icon PrimaryIconCssClass="rbClear" />
                                                    </telerik:RadButton>
                                                </td>
                                            </tr>
                                        </table>
                                             
 
                                    </td>
                                    <td></td>
                                    <td>
                                        <h3>Selected Fields</h3>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="vertical-align:top">
                                        <telerik:RadListBox ID="lstAvailable" runat="server"
                                                        Height="250px"
                                                        Width="250px"
                                                        AllowTransfer="true"
                                                        AllowTransferOnDoubleClick="true"
                                                        TransferToID="lstSelected"
                                                        EnableDragAndDrop="true"
                                                        OnClientTransferring="lstAvailable_OnClientTransferring"
                                                        ButtonSettings-ShowTransferAll="false" SelectionMode="Multiple" />
                                    </td>
                                    <td style="vertical-align: middle">
                                        <asp:ImageButton ID="btnMoveToSelected" runat="server" ImageUrl="/images/app/Button-Add.jpg" Visible="false" /><br />
                                        <asp:ImageButton ID="btnMoveToAvailable" runat="server" ImageUrl="/images/app/Button-Remove.jpg" Visible="false" />
                                    </td>
                                    <td>
                                        <telerik:RadListBox ID="lstSelected" runat="server"
                                            Height="250px"
                                            Width="250px"
                                            EnableDragAndDrop="true"
                                            AllowReorder="true" />
                                     </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td></td>
                    </tr>
                    <tr>
                        <td></td>
                    </tr>
                </table>
            </asp:Panel>
    </div>
    <telerik:RadCodeBlock runat="server">
    <script type="text/javascript">
 
        function filterList() {
            var listbox = $find("<%= lstAvailable.ClientID%>");
            var textbox = $find('<%= tbAvailableFilter.ClientID %>');
 
            clearListEmphasis(listbox);
            createMatchingList(listbox, textbox.get_textBoxValue());
        }
 
        // Remove emphasis from matching text in ListBox
        function clearListEmphasis(listbox) {
            var re = new RegExp("</{0,1}em>", "gi");
            var items = listbox.get_items();
            var itemText;
 
            items.forEach
            (
                function (item) {
                    itemText = item.get_text();
                    item.set_text(itemText.replace(re, ""));
                }
            )
        }
 
        // Emphasize matching text in ListBox and hide non-matching items
        function createMatchingList(listbox, filterText) {
            if (filterText != "") {
                filterText = escapeRegExCharacters(filterText);
 
                var items = listbox.get_items();
                var re = new RegExp(filterText, "i");
 
                items.forEach
                (
                    function (item) {
                        var itemText = item.get_text();
 
                        if (itemText.match(re)) {
                            item.set_text(itemText.replace(re, "<em>" + itemText.match(re) + "</em>"));
                            item.set_visible(true);
                        }
                        else {
                            item.set_visible(false);
                        }
                    }
                )
            }
            else {
                var items = listbox.get_items();
 
                items.forEach
                (
                    function (item) {
                        item.set_visible(true);
                    }
                )
            }
        }
 
        function lstAvailable_OnClientTransferring(sender, eventArgs) {
            // Transferred items retain the emphasized text, so it needs to be cleared.
            clearListEmphasis(sender);
            // Clear the list. Optional, but prevents follow up situation.
            clearFilterText();
            createMatchingList(sender, "");
        }
 
        function rbtnClear_OnClientClicking(sender, eventArgs) {
            clearFilterText();
 
            var listbox = $find("<%= lstAvailable.ClientID %>");
 
            clearListEmphasis(listbox);
            createMatchingList(listbox, "");
        }
 
        // Clears the text from the filter.
        function clearFilterText() {
            var textbox = $find('<%= tbAvailableFilter.ClientID %>');
            textbox.clear();
        }
 
        // Escapes RegEx character classes and shorthand characters
        function escapeRegExCharacters(text) {
            return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
        }
 
    </script>
</telerik:RadCodeBlock>
</form>

 

The code to populate data is

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
       If Not Page.IsPostBack Then
           ListAvailableFields()
       End If
   End Sub
 
   Private Sub ListAvailableFields()
 
       lstAvailable.Items.Clear()
       For temp As Integer = 1 To 10
           Dim name As String = $"Enabled {temp}"
           lstAvailable.Items.Add(New Telerik.Web.UI.RadListBoxItem(name, name))
 
           name = $"Disabled {temp}"
           lstAvailable.Items.Add(New Telerik.Web.UI.RadListBoxItem(name, name))
 
 
       Next
 
   End Sub

 

     Now, type something in the list. For example, type "Enabled" so that it filters all enabled columns.

     Once filtered , Click on first search result, HOLD down the shift key and Click on the last item in the grid to select ALL values in the listbox.

     Click on the right arrow and it should Copy all the selected values to the right grid.

      However, you will notice that it copied over Enabled xx as well as Disabled xx which was not in the search result.

    That is a problem, I filtered only "Enabled" but it moved "Disabled" as well.

     It seems list is hiding the items only, but when you select multiple using SHIFT key, it includes them. Selecting as many items as you can, using one at a time, will not be an issue.

 

      Any thoughts on this should be appreciated.

      Thank you

Sameers
Top achievements
Rank 1
 answered on 15 Feb 2019
3 answers
66 views

I have a usercontrol as my edit form, and a property called DataItem that gets bound, one item of which is called ItemID and is bound to a HiddenField. 

<asp:HiddenField ID="itemID" runat="server" Visible="false" Value='<%# DataBinder.Eval(Container, "DataItem.ItemID") %>' />

Everything seems good, form renders. I have two controls I call by button click, and in those handlers I can get the value of the HiddenField ItemID to pass its value along in a url.

"&ItemID=" & itemID.Value.ToString() &

 

The problem comes in when in Page_Load, I want to restrict whether to show these controls or not by the value of ItemID.  In Page_Load, itemID.Value is empty, presumably because the page hasn't loaded yet, and while _dataItem seems to exist, it has no fields yet.  Is there an event I can tie into to say 'run this after _dataItem has been bound'? There is OnDataBound, but the note on the documentation page says only useful with client side data binding and my solution uses NeedsDataSource.

Attila Antal
Telerik team
 answered on 15 Feb 2019
12 answers
390 views
When I try tabbing though my radgrid, it goes to the header, then the footer, then the actual body of the grid. I believe that this is happening because the tfoot tag is rendered before tbody. Is there any way to change that?
Rumen
Telerik team
 answered on 14 Feb 2019
3 answers
226 views

I have a row of totals in my grid. I add a custom footer to my grid where I add a grand total for 3 total columns to the last cell. I add a <br /> and &nbsp; to all the other cells as shown below.

if (e.Item is GridFooterItem)
        {
            GridFooterItem footerItem = (GridFooterItem)e.Item;
            {
                double a= 0;
                double b= 0;
                double c= 0;
                double sumA = 0;
                double sumB = 0;
                double sumC = 0;
                double total = 0;
 
                foreach (GridDataItem item in e.Item.OwnerTableView.Items)
                {
                    a= Double.Parse(item["A"].Text, NumberStyles.Currency);
                    sumA += a;
                    b= Double.Parse(item["B"].Text, NumberStyles.Currency);
                    sumB += b;
                    c= Double.Parse(item["C"].Text, NumberStyles.Currency);
                    sumC += c;
                }
 
                total = sumA + sumB + sumC;
 
                footerItem["A"].Text = sumA .ToString("c2") + "<br /> ";
                footerItem["B"].Text = sumB .ToString("c2") + "<br /> ";
                footerItem["C"].Text = sumC.ToString("c2") + "<br />" + total.ToString("c2");
            }

 

on my excel export the blank cell does not show. It seems excel is ignoring the line break and empty cell and just bottom aligning the total for me. See attached.

 

I even tried the approach in some other threads to replace the <br />  with &#10; but that just takes the new line away completely.

protected void grid_GridExporting(object sender, GridExportingArgs e)
    {
        RadGrid grid = (RadGrid)sender;       
        e.ExportOutput = e.ExportOutput.Replace("<br />", " ");
    }
Eyup
Telerik team
 answered on 14 Feb 2019
32 answers
1.1K+ views
Is there a Telerik control or does anyone know how to capture a signature in the web browser allowing the user to "draw" it and the submit/save it?  In C#?
Rumen
Telerik team
 answered on 14 Feb 2019
16 answers
490 views
I have a situation similar to this one. Basically, in the edit form I've got a dropdown list to which the user is able to use a popup to select a new value which triggers a postback so the value can be added to the popup and be selected in the popup. In the code-behind, I do
Dim editedItem As GridEditableItem = Nothing
If RadGrid1.MasterTableView.IsItemInserted Then
    editedItem = RadGrid1.MasterTableView.GetInsertItem()
End If
If IsNothing(editedItem) Then
    editedItem = RadGrid1.EditItems.Item(0)
End If
  
Dim ddl As DropDownList = CType(editedItem.FindControl("ddlId"), DropDownList)
ddl.Items.Insert(0, newValue)
ddl.SelectedValue = newValue
This works when I am adding a new item. However, if I am editing an existing item, the drop down list is not found; ddl is Nothing and I get a NullReferenceException.

In stepping through the code, in the add case, editedItem has a value of GridEditFormInsertItem with a type of GridEditableItem. However, in the edit case, its value is a GridDataItem with a type of GridEditableItem and its controls appear to be for the regular grid display rather than the edit form.

Any thoughts on how I can get this to work in the edit case?
Attila Antal
Telerik team
 answered on 13 Feb 2019
1 answer
181 views

I'm currently using R2 2018 SP1 and I'm experiencing a display issue with the grouping header. In my project, I have two grids that are very similar. Both use grouping but one one grid has static headers. 

When I use static headers, the grouping header show the column grid lines (i.e. row renders a <TD> for each column). But when I just simply remove theUseStaticHeaders="true" attribute, the grouping row is displayed as expected without the column grid lines (i.e. row renders with as one TD and a colspan attribute). Also note that I'm using the WebBlue theme.

See the attached screenshots displaying both situations.

I was unable to find this specific situation in the current grid demo so I was unable to confirm if this is a problem in the current release. 

Thanks

Loy.

 

Attila Antal
Telerik team
 answered on 13 Feb 2019
3 answers
1.0K+ views
How can I reset a RadTextBox to its configured EmptyMessage value using JavaScript?

Note, I want to use the property value without having to state it twice.

Thanks.
Rumen
Telerik team
 answered on 13 Feb 2019
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?