Hello
I have an @Mention function that works within a normal aspx textarea. It autocompletes names when entering the @ symbol and start typing the name. Do you know how I can get this to work within Radgrid. In the code below I need it specifically within the "Mat" column.
Here is the JavaScript:
////@mention function
$(document).ready(function () {
var availableTags = []; // You will fill this with data from server side
function split(val) {
return val.split(/@\s*/);
}
function extractLast(term) {
return split(term).pop();
}
$(".mention")
.on("keydown", function (event) {
if (event.keyCode === $.ui.keyCode.TAB && $(this).autocomplete("instance").menu.active) {
event.preventDefault();
}
})
.autocomplete({
minLength: 2,
source: function (request, response) {
var term = extractLast(request.term);
if (term.length >= 1) {
// ajax call to the server-side method
$.ajax({
url: './ProjectTracker.aspx/GetUsers',
method: 'POST',
contentType: 'application/json',
data: JSON.stringify({ 'prefix': term }),
success: function (data) {
response(data.d);
}
});
}
},
focus: function () {
return false;
},
select: function (event, ui) {
var terms = split(this.value);
// remove the term before '@' symbol
terms.pop();
// add the selected item
terms.push(ui.item.value);
// join the terms with '@' and append space, instead of '@' at the end
this.value = terms.join("@") + ' ';
return false;
}
});
});
$(".mention").autocomplete({
// ... other options ...
open: function () {
$(this).autocomplete('widget').css('width', $(this).outerWidth());
}
});
Here is the Radgrid:
<telerik:RadGrid RenderMode="Lightweight" OnPreRender="Slippage_PreRender" runat="server" ID="Slippage" AutoGenerateColumns="false"
OnNeedDataSource="Slippage_NeedDataSource" OnUpdateCommand="Slippage_UpdateCommand" OnItemDataBound="Slippage_ItemDataBound"
OnItemCreated="Slippage_ItemCreated" OnDeleteCommand="Slippage_DeleteCommand" Skin="WebBlue"
OnInsertCommand="Slippage_InsertCommand" ShowHeadersWhenNoRecords="true">
<MasterTableView AutoGenerateColumns="False" EditMode="InPlace" DataKeyNames="ID" InsertItemDisplay="Bottom" CommandItemDisplay="Bottom" EnableHeaderContextMenu="false" ShowHeadersWhenNoRecords="true">
<PagerStyle Mode="NextPrevAndNumeric" PageSizeLabelText="Page Size: " PageSizes="300" />
<Columns>
<telerik:GridEditCommandColumn HeaderStyle-Width="20" ItemStyle-Width="20" UniqueName="start">
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn DataField="Mat" DefaultInsertValue="" HeaderText="Slippage"
SortExpression="Mat" UniqueName="Mat" ItemStyle-CssClass="maximize">
</telerik:GridBoundColumn>
<telerik:GridCheckBoxColumn UniqueName="risk" HeaderText="At Risk" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="100px" DataField="risk" >
</telerik:GridCheckBoxColumn>
<telerik:GridButtonColumn Text="Delete" HeaderStyle-Width="50" ItemStyle-Width="50" CommandName="Delete" UniqueName="Delete"/>
</Columns>
</MasterTableView>
<ClientSettings AllowDragToGroup="false" AllowColumnsReorder="false">
<Resizing AllowColumnResize="false"></Resizing>
</ClientSettings>
</telerik:RadGrid>
<div style="clear: both"></div>
<br />
</div>
</div>
</div>
Here is the code for GetUsers:
[System.Web.Services.WebMethod]
public static List<string> GetUsers(string prefix)
{
List<string> users = new List<string>();
// Query your database here based on the prefix and fill the 'users' list
// This is a simple demonstration with static data
List<string> allUsers = new List<string> { "John", "Alpha Bravo", "James", "Zack Smith", "Joy" };
// For simplicity we are just doing a StartsWith. You might need to use a 'LIKE' query in SQL or equivalent
users = allUsers.Where(u => u.StartsWith(prefix, StringComparison.InvariantCultureIgnoreCase)).ToList();
return users;
}
Here is a normal textarea that works with the function:
<textarea class="mention" id="textArea" rows="4" cols="50"></textarea>
I've added these into the aspx page:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>I'm using a Rad MultiSelect to search for people, and I would like to include a link to the selected person's profile page within the item template. I noticed that when I use a RadButton, I don't see it on the page. When I use the <a OnClick> I see the hyperlink but I can't hit the controller action.
Is it possible that I just can't use a RadButton in the MultiSelect Item Template?
<ItemTemplate>
<span class="k-state-default">
<p>#: data.Foo#</p>
<a OnClick="detailsViewClick" runat="server" ID="Bar">View Details</a>
<%-- Commented out because this does not even show up on the view
<telerik:RadButton RenderMode="Lightweight" ID="Bar" runat="server" Text="ViewDetails" OnClick="detailsViewClick" >
</telerik:RadButton>--%>
</span>
</ItemTemplate>
Hi, I'm having trouble with a control called RadWindow. I show that control inside a normal asp form. The radwindow has a ContentTemplate inside it, and inside that content template I have all the controls of the form. What happens is that when the window is maximized then when you click on a datepicker or a comobox (both from telerik) the drop-down list of the combobox is not displayed nor the calendar of the radCalendar, which could be?
CODE:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="frmPruebaApariencia.aspx.vb" Inherits="frmPruebaApariencia" %>Hopefully I can successfully describe what I would like to accomplish. For years I have fought with the RadGrid and it's scrollbars, so let's see if the experts can finally put my struggle to rest.
I have a RagGrid that that has it's width set to 99% and contains quite a few resizable columns set to autofit. Fixed sizes are not an option. When I resize a column the grid grows causing the container around the grid to produce scrollbars. I would like the grid to remain a consistent size and have the grid produce the scrollbar when needed. Am I crazy to think that this should be achievable?
Using an Editor demo available from the demos, switch to HTML view and paste the following HTML into it:
<div class="row g-3">
<div class="col-6">
<h4>Left column...</h4>
<br />
This selector will match any element that has a class attribute starting with "col-". For example, it will match elements with classes like "col-1", "col-2", "col-header", etc.<br />
<br />
</div>
<div class="col-6"><span>Right column...</span></div>
</div>
Now, switch again to the Design mode.
Try to add some text after the "Right column..." text by placing the cursor in the end of the text, pressing enter and writing something, or just try to change that text format into an H4.
Editor will insert a new paragraph with the col-6 class and outside that DIV!
Here's the result:
<div class="row g-3">
<div class="col-6">
<h4>Left column...</h4>
<br />
This selector will match any element that has a class attribute starting with "col-". For example, it will match elements with classes like "col-1", "col-2", "col-header", etc.<br />
<br />
</div>
<div class="col-6"><span>Right column...</span></div>
<p class="col-6"><span>Just want to add more text...</span></p> --> this should not be here!
</div>
How can this be fixed? Need to provide some snippets but they are unusable this way.
Thank you
Hello.
Just renewed license.
I have a project with version 2022.3.913.40, wich came from previous versions always regularly upgraded with the extension from Visual Studio 2019.
Now I dowmloaded the latest, version 2023.2.606.45, but when I try to upgrade with the Upgrade Wizard from the extensions, the wizard says "no available Telerik projects that can be upgraded" and I can't upgrade.
What can I do?
Matteo
I have a rad grid with toggle buttons if i select one i need the grid to be disabled and if i switch to another it needs to be enabled i am using onclientcheckedchanged event.
All other buttons are disabled apart from that, but not the whole grid, atleast i need the checkboxed in the grid to be disabled.
could you give me a solution.
Hello,
We have an application that is used by clients from different countries in multiple languages. The date and number formats have to be the same for all clients in a certain country, the language can be selected by the user.
This works well by specifying the Thread.CurrentThread.CurrentCulture for the date and number formats and the Thread.CurrentThread.CurrentUICulture for the culture of the user's language.
When formatting dates, the names of the days and months are taken from the CurrentCulture. To make sure these names match the UICulture, we copy the names from the UICulture to the Culture. This works fine in most situations (for example in the DateTime.Format() function).
The behaviour of the RadDatePicker and RadMonthYearPicker seems a bit off though. In the picker (popup) the day and month names are correctly taken from the culture as we set them. In the input field however, the original day and month names are used. This seems wrong to me. Are we doing something wrong, or is this a bug in how the date pickers use the culture settings?
var uiCulture = CultureInfo.CreateSpecificCulture("nl-NL");
var customCulture = CultureInfo.CreateSpecificCulture("en-US");
customCulture.DateTimeFormat.AbbreviatedDayNames = uiCulture.DateTimeFormat.AbbreviatedDayNames;
customCulture.DateTimeFormat.DayNames = uiCulture.DateTimeFormat.DayNames;
customCulture.DateTimeFormat.AbbreviatedMonthGenitiveNames = uiCulture.DateTimeFormat.AbbreviatedMonthNames;
customCulture.DateTimeFormat.AbbreviatedMonthNames = uiCulture.DateTimeFormat.AbbreviatedMonthNames;
customCulture.DateTimeFormat.MonthNames = uiCulture.DateTimeFormat.MonthNames;
customCulture.DateTimeFormat.MonthGenitiveNames = uiCulture.DateTimeFormat.MonthGenitiveNames;
customCulture.DateTimeFormat.ShortestDayNames = uiCulture.DateTimeFormat.ShortestDayNames;
Thread.CurrentThread.CurrentCulture = customCulture;
Thread.CurrentThread.CurrentUICulture = uiCulture;
The day and month names of the picker are localized, the input field is not.
Thanks for any suggestions,
Cloud9Software.
Hi,
I have several PDFViewer in different pages of my application, contained in div that can be collapsed.
Depending of the pages the div can be collapsed or not at loading of the page.
For the ones that are not collapsed, the PDFViewer scale is set to "Fit to Width" and the scaling is ok.
However, for the ones that are in collapsed div, the "Fit to Width" setting is not processed.
Attached is a project with the described behavior.
Is there a way to manage the scaling properly on collapsed PDFViewer ?
I'm using RadListBox as as RadTreeview in my page.
I'm binding data to RadTreeview with:
List<SiteDataItem> siteData = GetNotificationTree();
treeView.DataTextField = "Text";
treeView.DataFieldID = "ID";
treeView.DataFieldParentID = "ParentID";
treeView.DataSource = siteData;
treeView.DataBind();
Serverside I want to read the Value of the checked items. In Listbox that works with:
ListBox.CheckedItems.Select(_ => int.Parse(_.Value))
But in Treeview I'm not able to access the values e.g. with:
Treeview..CheckedNodes.Select(_ =>int.Parse(_.Value)). I'm only able to read the text property but not the value bound to the TreeView.