or
Request is not available in this context
Referred this but no help.
at System.Web.UI.Page.get_Request() at Telerik.Web.UI.RadGrid.BrowserIsCrawler() at Telerik.Web.UI.RadGrid.OnInit(EventArgs e) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.AddedControl(Control control, Int32 index) at System.Web.UI.ControlCollection.Add(Control child) at MyPage.productControl(Page& Page, Control& ctrl, HttpServerUtility& Server) in C:\inetpub\wwwroot\Test\test.vb:line 45 at testControl() in C:\inetpub\wwwroot\TestC\Ctrl1.ascx.vb:line 37 at page_Load(Object sender, EventArgs e) in C:\inetpub\wwwroot\TestC\Ctrl1.ascx.vb:line 15 at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.AddedControl(Control control, Int32 index) at System.Web.UI.ControlCollection.Add(Control child) at tabMultiPage1_PageViewCreated(Object sender, RadMultiPageEventArgs e) in C:\inetpub\wwwroot\Product.aspx.vb:line 324 at Telerik.Web.UI.RadMultiPage.OnPageViewCreated(RadMultiPageEventArgs eventArgs) at Telerik.Web.UI.RadMultiPage.AddedControl(Control control, Int32 index) at System.Web.UI.ControlCollection.Add(Control child) at Telerik.Web.UI.RadPageViewCollection.Add(RadPageView pageView) at Home.AddTab(String stringName, XmlNode xNode,String ctrlName) in C:\inetpub\wwwroot\Product.aspx.vb:line 192 at Handler.Submit(RadMultiPage& tabMultiPage, XmlDocument docRequest) in C:\inetpub\wwwroot\Handling.vb:line 101 at TreeControl.Button2_Click(Object sender, EventArgs e) in C:\inetpub\wwwroot\Controls\TreeControl.ascx.vb:line 424 at System.Web.UI.WebControls.Button.OnClick(EventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)public void InstantiateIn(Control container) { if (null != container) { // Create the panel using (Panel categoryPanel = new Panel()) { categoryPanel.ID = "CategoriesDropDownPanel"; categoryPanel.Width = Unit.Percentage(100); categoryPanel.DataBinding += new EventHandler(CategoryPanel_DataBinding); // Create the checkbox using (CheckBox checkBox = new CheckBox()) { checkBox.ID = "CategoriesDropDownCheckBox"; checkBox.Text = "Category"; checkBox.DataBinding += new EventHandler(CheckBox_DataBinding); categoryPanel.Controls.Add(checkBox); } container.Controls.Add(categoryPanel); } } }private void CategoryPanel_DataBinding(object sender, EventArgs e){ // TODO: Never gets called! Panel target = (Panel)sender; RadComboBoxItem container = (RadComboBoxItem)target.BindingContainer; Category category = (Category)container.DataItem; target.BackColor = System.Drawing.Color.FromArgb(category.Color);}private void CheckBox_DataBinding(object sender, EventArgs e){ // TODO: Never gets called! CheckBox target = (CheckBox)sender; RadComboBoxItem container = (RadComboBoxItem)target.BindingContainer; target.Text = (string)DataBinder.Eval(container.DataItem, "Name");}using System;using System.Globalization;using System.Collections;using System.ComponentModel;using System.Web.UI;using System.Web.UI.WebControls;using Telerik.Web.UI;using System.Collections.ObjectModel;using System.Web.UI.HtmlControls;using System.Data;using CategoryDropDownTest.Entities;namespace CategoryDropDownTest.CustomControls{ /// <summary> /// USG Web Server Control for displaying a category dropdown in a website /// </summary> [ToolboxData("<{0}:CategoryDropDown runat=server></{0}:CategoryDropDown>"), /*ParseChildren(false),*/ ParseChildren(ChildrenAsProperties = true), PersistChildren(false), DefaultProperty("Text")] public class CategoryDropDown : CompositeControl, INamingContainer { #region Private Members private RadComboBox radCategoryDropDown; private Collection<Category> items = new Collection<Category>(); #endregion #region Public Properties /// <summary> /// gets the collection of Category /// </summary> [DesignerSerializationVisibility(DesignerSerializationVisibility.Content), PersistenceMode(PersistenceMode.InnerProperty), MergableProperty(false), Category("CategoryDropDown Properties"), Description("Categories of the dropdown menu.")] public Collection<Category> Items { get { return items; } } /// <summary> /// Gets or sets the Text to be displayed /// </summary> [Category("CategoryDropDown Properties"), Description("Text for the categoryDropDown")] public string Text { get; set; } #endregion #region Overriden Methods #region RenderContents /// <summary> /// Overridden RenderContents /// </summary> /// <param name="writer">HmltTextWriter parameter</param> protected override void RenderContents(HtmlTextWriter writer) { if (this.DesignMode) { // In design mode, display only the id if (writer != null) writer.WriteLine(this.ID); } else { } base.RenderContents(writer); } #endregion #region OnInit /// <summary> /// Overridden OnInit /// </summary> /// <param name="e">EventArfs parameter</param> protected override void OnInit(EventArgs e) { // Initialize the controls this.InitControl(); base.OnInit(e); } #endregion #region OnLoad /// <summary> /// Overriden OnLoad /// </summary> /// <param name="e">EventArgs parameter</param> protected override void OnLoad(EventArgs e) { // Load the control this.LoadControl(); base.OnLoad(e); } #endregion #endregion #region Private Methods /// <summary> /// Initialize the control /// </summary> private void InitControl() { // Create the RadCategoryDropDown this.radCategoryDropDown = new RadComboBox(); } #region LoadControl /// <summary> /// Load the control /// </summary> private void LoadControl() { // Set fixed properties //this.radCategoryDropDown.HeaderTemplate = new HeaderTemplate(); this.radCategoryDropDown.ItemTemplate = new ItemTemplate(); this.radCategoryDropDown.ChangeTextOnKeyBoardNavigation = false; this.radCategoryDropDown.EnableTextSelection = false; this.radCategoryDropDown.HighlightTemplatedItems = true; this.radCategoryDropDown.EnableViewState = false; // Bind the events this.radCategoryDropDown.ItemDataBound += new RadComboBoxItemEventHandler(RadCategoryDropDown_ItemDataBound); // Add the properties this.radCategoryDropDown.Text = this.Text; if ((null != this.items) && (this.items.Count > 0)) { this.radCategoryDropDown.DataSource = this.items; this.radCategoryDropDown.DataTextField = "Name"; this.radCategoryDropDown.DataValueField = "Id"; this.radCategoryDropDown.DataBind(); } // Add the control this.Controls.Add(radCategoryDropDown); } #endregion #region Events /// <summary> /// ItemDataBound event of the radCategoryDropDown /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void RadCategoryDropDown_ItemDataBound(object sender, RadComboBoxItemEventArgs e) { if (e != null) { // Get the category Category category = (Category) e.Item.DataItem; // Find the panel Panel itemPanel = (Panel)e.Item.FindControl("CategoriesDropDownPanel"); if (null != itemPanel) { // TODO: Check if it can be added through the item template //itemPanel.BackColor = System.Drawing.Color.FromArgb(category.Color); // Find the checkbox CheckBox itemCheckBox = (CheckBox) itemPanel.FindControl("CategoriesDropDownCheckBox"); if (null != itemPanel) { // TODO: Remove, should be added through the item template //itemCheckBox.Text = category.Name; } } } } #endregion #endregion }}