| <telerik:RadComboBox ID="CbAircraftModelType" runat="server" Skin="Black" |
| SelectedValue='<%# Bind("modelTypeName") %>' EmptyMessage=" Select Aircraft Type" |
| HighlightTemplatedItems="True" DataTextField="modelTypeName" DataValueField="modelTypeId" |
| EnableTextSelection="False" DataSourceID="SqlDataSource_AircraftType" |
| OnClientSelectedIndexChanged="cb_OnClientSelectedIndexChanged" /> |
| <asp:SqlDataSource ID="SqlDataSource_AircraftType" runat="server" |
| ConnectionString="<%$ ConnectionStrings:AvengeConnectionString %>" |
| SelectCommand="select modelTypeName,modelTypeId from Avenge.dbo.AircraftModelType "> |
| </asp:SqlDataSource> |
| Selection out of range |
| Parameter name: value |
| Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. |
| Exception Details: System.ArgumentOutOfRangeException: Selection out of range |
| Parameter name: value |
| Source Error: |
| An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
| Stack Trace: |
| [ArgumentOutOfRangeException: Selection out of range |
| Parameter name: value] |
| Telerik.Web.UI.RadComboBox.PerformDataBinding(IEnumerable dataSource) +172 |
| Telerik.Web.UI.RadComboBox.OnDataSourceViewSelectCallback(IEnumerable data) +39 |
| System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31 |
| Telerik.Web.UI.RadComboBox.OnDataBinding(EventArgs e) +102 |
| Telerik.Web.UI.RadComboBox.PerformSelect() +37 |
| System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73 |
| System.Web.UI.Control.DataBindChildren() +211 |
| System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +102 |
| System.Web.UI.Control.DataBind() +15 |
| System.Web.UI.Control.DataBindChildren() +211 |
| System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +102 |
| System.Web.UI.Control.DataBind() +15 |
| System.Web.UI.Control.DataBindChildren() +211 |
| System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +102 |
| System.Web.UI.Control.DataBind() +15 |
| System.Web.UI.Control.DataBindChildren() +211 |
| System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +102 |
| System.Web.UI.Control.DataBind() +15 |
| System.Web.UI.Control.DataBindChildren() +211 |
| System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +102 |
| System.Web.UI.Control.DataBind() +15 |
| System.Web.UI.Control.DataBindChildren() +211 |
| System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +102 |
| System.Web.UI.Control.DataBind() +15 |
| System.Web.UI.Control.DataBindChildren() +211 |
| System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +102 |
| System.Web.UI.Control.DataBind() +15 |
| System.Web.UI.Control.DataBindChildren() +211 |
| System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +102 |
| System.Web.UI.Control.DataBind() +15 |
| System.Web.UI.Control.DataBindChildren() +211 |
| System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +102 |
| System.Web.UI.Control.DataBind() +15 |
| Telerik.Web.UI.GridEditFormItem.SetupItem(Boolean dataBind, Object dataItem, GridColumn[] columns, ControlCollection rows) +387 |
| Telerik.Web.UI.GridItemBuilder.CreateItems(GridGroupingContext group) +979 |
| Telerik.Web.UI.GridTableView.CreateItems(IEnumerator enumerator, GridColumn[] columns, ControlCollection controls) +187 |
| Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource) +1573 |
| Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +782 |
| System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +57 |
| System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +114 |
| System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31 |
| System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142 |
| Telerik.Web.UI.GridTableView.PerformSelect() +28 |
| System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73 |
| Telerik.Web.UI.GridTableView.DataBind() +351 |
| Telerik.Web.UI.GridTableView.Rebind() +98 |
| Telerik.Web.UI.GridCommandEventArgs.ExecuteCommand(Object source) +395 |
| Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e) +191 |
| System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37 |
| Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +165 |
| System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37 |
| System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +118 |
| System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +135 |
| System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 |
| System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 |
| System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175 |
| System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565 |
| Hope someone will be able to help me with this. |
| Thanks. |
System.NullReferenceException: Object reference not set to an instance of an object.
at Telerik.Web.UI.ControlItem.LoadFromDictionary(IDictionary`2 dictionary)
at Telerik.Web.UI.ClientStateLogPlayer`1.Insert(ClientStateLogEntry entry, ControlItemCollection items, Int32 index)
at Telerik.Web.UI.ClientStateLogPlayer`1.Play(ClientStateLogEntry entry)
at Telerik.Web.UI.ClientStateLogPlayer`1.Play(IEnumerable`1 clientStateLogEntry)
at Telerik.Web.UI.RadComboBox.LoadClientState(RadComboBoxClientState clientState)
at Telerik.Web.UI.RadComboBox.LoadPostData(String postDataKey, NameValueCollection postCollection)
at Telerik.Web.UI.RadDataBoundControl.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection)
at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
|
Requirements |
|
| RadControls version |
2009.01.0311.20 |
| .NET version |
2.0 |
| Visual Studio version |
2005 |
| programming language |
C# |
| browser support |
all browsers supported by RadControls |
The project demonstrates on how to filter a grid automatically on typing every single letter into the filter textbox. For this purpose an 'onkeyup' client event is added to the filter textbox wherein filtering is performed and the unique name of the currently filtered column is stored into a hidden field. The filter textbox of the current column is focused after a filtering has been performed and the cursor position in the textbox is set by adding an 'onfocus' client event to the filter textbox of that column.
aspx:| <%@ 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.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head > |
| <title>Untitled Page</title> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <asp:ScriptManager ID="ScriptManager1" runat="server" /> |
| <div> |
| <input id="Hidden1" runat="server" name="Hidden1" type="hidden"/> |
| <telerik:RadGrid ID="RadGrid" runat="server" AutoGenerateColumns="true" AllowPaging="true" PageSize="10" AllowFilteringByColumn="True" DataSourceID="SqlDataSource1" OnItemDataBound="RadGrid_ItemDataBound" OnPreRender="RadGrid_PreRender"> |
| <MasterTableView> |
| </MasterTableView> |
| </telerik:RadGrid> |
| <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" SelectCommand="SELECT [CustomerID], [CompanyName], [ContactName], [ContactTitle], [Address], [City], [PostalCode] FROM [Customers]"></asp:SqlDataSource> |
| </div> |
| </form> |
| </body> |
| </html> |
| using System; |
| using System.Data; |
| using System.Configuration; |
| using System.Web; |
| using System.Web.Security; |
| using System.Web.UI; |
| using System.Web.UI.WebControls; |
| using System.Web.UI.WebControls.WebParts; |
| using System.Web.UI.HtmlControls; |
| using Telerik.Web.UI; |
| public partial class _Default : System.Web.UI.Page |
| { |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| } |
| protected void RadGrid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) |
| { |
| if (e.Item is GridFilteringItem) |
| { |
| GridFilteringItem filterItem = (GridFilteringItem)e.Item; |
| foreach (GridColumn col in RadGrid.MasterTableView.RenderColumns) |
| { |
| if ((col.UniqueName != "ExpandColumn") && (col.UniqueName != "RowIndicator") ) |
| { |
| TextBox filtertxt = (TextBox)filterItem[col.UniqueName].Controls[0]; |
| filtertxt.Attributes.Add("onkeyup", "Filter('" + col.UniqueName + "','" + filtertxt.ClientID + "')"); |
| } |
| } |
| } |
| } |
| protected void RadGrid_PreRender(object sender, EventArgs e) |
| { |
| if (Hidden1.Value != "") |
| { |
| GridFilteringItem filter = (GridFilteringItem)RadGrid.MasterTableView.GetItems(GridItemType.FilteringItem)[0]; |
| TextBox txtfilter = (TextBox)filter[Hidden1.Value].Controls[0]; |
| txtfilter.Focus(); |
| txtfilter.Attributes.Add("onFocus", "FocusFilter('" + txtfilter.ClientID + "');"); |
| } |
| } |
| } |
| <script type="text/javascript"> |
| function Filter(colName,filtertxt) |
| { |
| var filterTxt = document.getElementById(filtertxt); |
| var MasterTable = $find("<%= RadGrid.ClientID %>").get_masterTableView(); |
| var hidden = document.getElementById('<%=Hidden1.ClientID %>'); |
| hidden.value = colName; |
| if(filterTxt.value.length>0) |
| { |
| MasterTable.filter(colName, filterTxt.value, Telerik.Web.UI.GridFilterFunction.StartsWith); |
| } |
| else |
| { |
| MasterTable.filter(colName, filterTxt.value, Telerik.Web.UI.GridFilterFunction.NoFilter); |
| } |
| } |
| function FocusFilter(filter) |
| { |
| var input = document.getElementById(filter); |
| if (input.createTextRange) |
| { |
| var FieldRange = input.createTextRange(); |
| FieldRange.moveStart('character', input.value.length); |
| FieldRange.select(); |
| } |
| } |
| </script> |