function filterSearch(){ var combo = $find('<%=RadComboBox1.ClientID %>'); var textbox = document.getElementById("txtSearch"); var selectedItemsCount = combo.get_selectedItems().length; if (selectedItemsCount == 0) { alert("You must select a category before processing search!"); return false; }}<asp:Button ID="btnSearch" runat="server" Style="float: left; color: black; font-weight: bold" Text="Search" OnClick="btnSearch_Click" OnClientClick="javascript: return filterSearch();" />I have a simple RadGrid with this design:
<div id="Grid"> <telerik:RadGrid RenderMode="Lightweight" runat="server" AllowPaging="true" ID="RadGrid1" AutoGenerateColumns="false" OnItemCommand="RadGrid1_ItemCommand" OnItemCreated="RadGrid1_ItemCreated" OnPreRender="RadGrid1_PreRender1" OnItemDataBound="RadGrid1_ItemDataBound" OnNeedDataSource="RadGrid1_NeedDataSource" AllowAutomaticDeletes="false" AllowAutomaticInserts="true" AllowAutomaticUpdates="true" > <MasterTableView DataKeyNames="UserID" CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage"> <Columns> <telerik:GridEditCommandColumn UniqueName="EditCommandColumn"> </telerik:GridEditCommandColumn> <telerik:GridBoundColumn DataField="UserID" HeaderText="User ID" ReadOnly="true" ForceExtractValue="Always" ConvertEmptyStringToNull="true" Visible="false"/> <telerik:GridTemplateColumn UniqueName="ActiveColumn" HeaderText="Active"> <ItemTemplate> <asp:Label ID="lblActive" runat="server" Text='<%# Convert.ToBoolean(Eval("Active")) == true ? "Yes" : "No" %>'></asp:Label> </ItemTemplate> <InsertItemTemplate> <asp:CheckBox runat ="server" ID="chkInsertActive" /> </InsertItemTemplate> <EditItemTemplate> <asp:CheckBox runat="server" ID ="chkActive" Checked='<%# DataBinder.Eval(Container.DataItem,"Active") %>' /> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="Role"> <ItemTemplate> <%#DataBinder.Eval(Container.DataItem,"Role") %> </ItemTemplate> <EditItemTemplate> <asp:DropDownList ID="ddlRole" runat="server" ></asp:DropDownList> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn UniqueName="FirstNameColumn" HeaderText="First Name"> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem,"FirstName") %> </ItemTemplate> <EditItemTemplate> <asp:TextBox ID="txtFirstName" runat="server" Text='<%# Bind("FirstName") %>'></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="* First Name Is Required" ForeColor="Red" ControlToValidate="txtFirstName"></asp:RequiredFieldValidator> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="Last Name"> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem, "LastName") %> </ItemTemplate> <EditItemTemplate> <asp:TextBox ID="txtLastName" runat="server" Text='<%# Bind("LastName") %>'></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="* Last Name Is Required" ForeColor="Red" ControlToValidate="txtLastName"></asp:RequiredFieldValidator> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="User Name"> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem, "UserName") %> </ItemTemplate> <EditItemTemplate> <asp:TextBox ID="txtUserName" runat="server" Text='<%# Bind("UserName") %>'></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="* User Name Is Required" ForeColor="Red" ControlToValidate="txtUserName"></asp:RequiredFieldValidator> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="Email Address"> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem, "EmailAddress") %> </ItemTemplate> <EditItemTemplate> <asp:TextBox ID="txtEmail" runat="server" Text='<%# Bind("EmailAddress") %>'></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="* Email Is Required" ForeColor="Red" ControlToValidate="txtEmail"></asp:RequiredFieldValidator> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn> <ItemTemplate> <asp:Button ID="btnDelete" CssClass="btn btn-xs btn-danger" Text="Delete" runat="server" OnClick="BtnDelete_Click" OnClientClick="confirmAspButton(this); return false;"> </asp:Button> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView> <PagerStyle Mode="NextPrevAndNumeric" /> </telerik:RadGrid> </div>
Then I created C# code to filter the Grid by user and or Role with this code. I am not showing all of the code just enough to give a picture of what I am working with:
if (txtName.Text.Length > 0 && ddlRole.SelectedIndex == 0){ string a = txtName.Text; using (ExpungeEntities db = new ExpungeEntities()) { RadGrid1.DataSource = db.USERS_T_DATA.Where(c => c.FirstName.Contains(a) || c.LastName.Contains(a)).ToList(); { RadGrid1.Rebind(); int intGridCount = RadGrid1.Items.Count; if (intGridCount == 0) { DisplayMessage("No records matched your search"); txtName.Text = string.Empty; } } }}
The code works as expected and I endup with a filtered grid. but here is the issue I am trying to solve. When I click the "edit" icon that was created by my use of the AllowAutomaticUpdates I am presented with the first row in the grid for updating instead of the intended row. I have taken a screen shot that shows the issue to help explain.
How can I get the correct row to display for edit?
I had done out of the box customization for RadGrdi in batch edit mode.
For some reason I had set AllowKeyBoardNavigation = 'false'.
(If I set it as true the horizontal scroll works wired, which i already raised in the forum)
https://www.telerik.com/forums/weird-behavior-of-radgrid's-horizontal-scroll-bar-with-keyboard-navigation-in-ie-browser
Now I want that on hitting Esc if is there any cell in Active Edit Mode then it should close the editing for that particular cell only. and I want to achieve this functionality using client-side code.
Hi,
I've got a chart that has 1 scatter line series plotted on it with dates on the x axis and numbers on the y axis. Every time i zoom in then zoom out, less is visible than was available before. I also have pan enabled and you can't pan up to the hidden values anymore either. Is this a configuration I'm missing? I attached pictures to show, I assure you I tried zooming out as far as it would let me
I found the inconsistent behavior (Focus moved at a different place) of selecting the cell in Rad grid for IE Browser.
As I had 15 columns displayed in my grid. So, I get horizontal scrollbar definitely.
For selecting any cell of the last column I scroll horizontally and try to select any cell.
As soon as I click on any cell the scroll reset to its default position although the cell would be selected.
PS. This will only happen if I had set property ## AllowKeyboardNavigation="true" ##
HI,
In RAD Grid can we have export to Excel functionality export the data in an .xlsx file instead of a .xls file , because in our application we have to export 180K records , and in xls it is giving out of memory error , we were hoping that if we could export It to .xlsx this error might not come.
Thanks
Hemant.

Hello,
I found the inconsistent behavior (Focus moved at a different place) of selecting the cell in Rad grid for IE Browser.
As I had 15 columns displayed in my grid. So, I get horizontal scrollbar definitely.
For selecting any cell of the last column I scroll horizontally and try to select any cell.
As soon as I click on any cell the scroll reset to its default position although the cell would be selected.
PS. This will only happen if I had set property ## AllowKeyboardNavigation="true" ##
Good afternoon,
I am trying to connect a RadClientDataSource to a web Service but it is not getting called (I know because i am tracing the sql database that it uses and I have tried with breakpoints). At present the code is:
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPageSingleMenu.Master" AutoEventWireup="true" CodeFile="Grid.aspx.cs" Inherits="Grid" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<link href="styles/grid.css" rel="stylesheet" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
<telerik:RadGrid RenderMode="Lightweight" ID="dgSessions" runat="server" AutoGenerateColumns="false" AllowSorting="true"
EnableHeaderContextMenu="true" ClientDataSourceID="RadClientDataSource1"
AllowMultiRowSelection="false" >
<MasterTableView Width="100%" ClientDataKeyNames="SessionKey" DataKeyNames="SessionKey" CommandItemDisplay="None">
<Columns>
<telerik:GridBoundColumn UniqueName="HorseName" HeaderText="Horse" DataField="HorseName" ReadOnly="True">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="BT200" HeaderText="BT200" DataField="BT200" ReadOnly="True">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
<telerik:RadClientDataSource ID="RadClientDataSource1" runat="server">
<DataSource>
<WebServiceDataSourceSettings ServiceType="OData" >
<Select Url="http://localhost:49833/ETSession.svc/GetSessions" DataType="JSON" />
</WebServiceDataSourceSettings>
</DataSource>
<Schema>
<Model ID="SessionKey">
<telerik:ClientDataSourceModelField FieldName="SessionKey" />
<telerik:ClientDataSourceModelField FieldName="HorseName" DataType="String" />
<telerik:ClientDataSourceModelField FieldName="BT200" />
</Model>
</Schema>
</telerik:RadClientDataSource>
</asp:Content>
I have tried with a remote web service, also with the web service code file in the same project as the page, but to no avail.
I have also tried the follwing snippet:
<WebServiceDataSourceSettings ServiceType="OData" BaseUrl="http://localhost:49833/ETSession.svc/" >
<Select Url="GetSessions" DataType="JSON" />
</WebServiceDataSourceSettings>
This results in GetSessions giving a Not Found indicator (green squigly line under the name) - that occurs in all three scenarios (remote, local or in-place).
The service works as i have tested it from another project.
Using VS2010 and .Net 4
Would welcome any thoughts.
Mary
Hello,
I need to get the sortorder of the Grid in _NeedDataSource even and nowhere else. However the SortOrder value is always 'Ascending'. How do you get the updated sort order ? I have code below. Thank you.
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e){...string name = RadGrid1.MasterTableView.SortExpressions[0].FieldName; GridSortOrder order = RadGrid1.MasterTableView.SortExpressions[0].SortOrder;}