ComponentColumn Editor Bug?

  1. #1

    ComponentColumn Editor Bug?

    Hello again,

    First let me explain my objective. I have a field in my gridpanel that has a combo-box that reads from a seperate datasource. I'm trying to have that field show the same text value that the combo-box showed in the editor, however, I do not want to make a view or any alteration to the query that drives the gridpanel's store. I figured in the fashion of vanilla asp.net that I could make a combo-box that is a read-only copy of the one in the editor, I figured component column is the tool for the job, however I get an error when I try and implement editor. This error seems like a bug unless editor in a ComponentColumn is unsupported.

    <ext:ComponentColumn ColumnID="StateId" runat="server" DataIndex="StateId" Header="StateId">
                        <Component>
                            <ext:SelectBox ID="select1" runat="server" DisplayField="Name" ValueField="Id" EmptyText="Select a State..." Enabled="false">
    							<Store>
    								<ext:Store runat="server">
    									<Model>
    										<ext:Model runat="server">
    											<Fields>
    												<ext:ModelField Name="Id" />
    												<ext:ModelField Name="Name" />
    											</Fields>
    											<Proxy>
    												<ext:AjaxProxy Json="true" SortParam="sort" LimitParam="limit" StartParam="start" PageParam="page">
    													<API Read="/State/Read" />
    													<ActionMethods Read="GET" />   
    													<Reader>
    														<ext:JsonReader Root="data" MessageProperty="Message" TotalProperty="total"  />
    													</Reader> 
    												</ext:AjaxProxy>
    											</Proxy>
    										</ext:Model>
    									</Model>
    								</ext:Store>
    							</Store>
    						</ext:SelectBox>                    
                        </Component>
                        <Editor>
                            <ext:SelectBox ID="select2" runat="server" DisplayField="Name" ValueField="Id" EmptyText="Select a State...">
    							<Store>
    								<ext:Store ID="Store1" runat="server">
    									<Model>
    										<ext:Model ID="Model1" runat="server">
    											<Fields>
    												<ext:ModelField Name="Id" />
    												<ext:ModelField Name="Name" />
    											</Fields>
    											<Proxy>
    												<ext:AjaxProxy Json="true" SortParam="sort" LimitParam="limit" StartParam="start" PageParam="page">
    													<API Read="/State/Read" />
    													<ActionMethods Read="GET" />   
    													<Reader>
    														<ext:JsonReader Root="data" MessageProperty="Message" TotalProperty="total"  />
    													</Reader> 
    												</ext:AjaxProxy>
    											</Proxy>
    										</ext:Model>
    									</Model>
    								</ext:Store>
    							</Store>
    						</ext:SelectBox>
                        </Editor>
    </ext:ComponentColumn>
    Generates the error

    [HttpException]: Type 'System.Boolean' does not have a public property named 'SelectBox'.
       at System.Web.UI.ControlBuilder.GetChildPropertyBuilder(String tagName, IDictionary attribs, Type& childType, TemplateParser templateParser, Boolean defaultProperty)
       at System.Web.UI.ControlBuilder.CreateChildBuilder(String filter, String tagName, IDictionary attribs, TemplateParser parser, ControlBuilder parentBuilder, String id, Int32 line, VirtualPath virtualPath, Type& childType, Boolean defaultProperty)
       at System.Web.UI.TemplateParser.ProcessBeginTag(Match match, String inputText)
       at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
    [HttpParseException]: Type 'System.Boolean' does not have a public property named 'SelectBox'.
       at System.Web.UI.TemplateParser.ProcessException(Exception ex)
       at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
       at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
    [HttpParseException]: Type 'System.Boolean' does not have a public property named 'SelectBox'.
       at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
       at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
       at System.Web.UI.TemplateParser.Parse()
       at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
       at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
       at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
       at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
       at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
       at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
       at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
       at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
       at System.Web.Mvc.BuildManagerWrapper.System.Web.Mvc.IBuildManager.FileExists(String virtualPath)
       at System.Web.Mvc.VirtualPathProviderViewEngine.GetPathFromGeneralName(ControllerContext controllerContext, List`1 locations, String name, String controllerName, String areaName, String cacheKey, String[]& searchedLocations)
       at System.Web.Mvc.VirtualPathProviderViewEngine.GetPath(ControllerContext controllerContext, String[] locations, String[] areaLocations, String locationsPropertyName, String name, String controllerName, String cacheKeyPrefix, Boolean useCache, String[]& searchedLocations)
       at System.Web.Mvc.VirtualPathProviderViewEngine.FindView(ControllerContext controllerContext, String viewName, String masterName, Boolean useCache)
       at System.Web.Mvc.ViewEngineCollection.<>c__DisplayClassc.<FindView>b__b(IViewEngine e)
       at System.Web.Mvc.ViewEngineCollection.Find(Func`2 lookup, Boolean trackSearchedPaths)
       at System.Web.Mvc.ViewResult.FindView(ControllerContext context)
       at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
       at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
       at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
       at System.Web.Mvc.Controller.ExecuteCore()
       at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
       at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.<BeginProcessRequest>b__5()
       at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0()
       at System.Web.Mvc.MvcHandler.<>c__DisplayClasse.<EndProcessRequest>b__d()
       at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    This happens regardless of what I put in the Editor tag. Removing the contents of editor (can leave the editor tag itself) fixes the problem. Returning it to a normal column type also fixes the problem.

    I figured I would present this in case it is truly a bug and not just an issue of an unsupported functionality.

    Either way if I could get some "tried and true" methods to solve my problem that would be helpful. Once again, I don't want to modify the underlying data source which will provide the ID (FK) that correlates to the item in the lookup table that the state drop down is driven by. At least that is my last option if there is no better way.

    Thanks!
  2. #2
  3. #3
    Thanks for your prompt response.

    Unfortunately I'm not seeing the functionality I'm looking for in these examples. To use the examples to demonstrate my goal, I would like the text displayed when the editor is not present to be "Item 1", the "text" if you will, rather than the value "1". I would like to accomplish this using a seperate data source pointing at a lookup table that can resolve what the text for the value "1" would be.

    In ASP.NET vanilla I would do this by having a gridview whose data source has the foreign key, "1" in this case, and a dropdownlist that is disabled and specifies a data source that is the lookup table, the primary table for that key.

    Any ideas?
  4. #4
    I am not sure that understood you
    Can you demosntrate the problem on test sample?
  5. #5
    Click image for larger version. 

Name:	Combo1.png 
Views:	3 
Size:	23.0 KB 
ID:	4596Click image for larger version. 

Name:	Combo2.png 
Views:	4 
Size:	34.0 KB 
ID:	4597

    In ASP.NET I would do this :

    <asp:Gridview runat="server" DataSourceID="dsAddresses">
         <Columns>
              <asp:TemplateField>
                   <ItemTemplate>
                        <asp:DropDownList runat="server" DataSourceID="dsStates" Text='<%# Eval("StateID") %>' DataTextField="Name" DataValueField="ID" />
                   </ItemTemplate>
              </asp:TemplateField>
         </Columns>
    </asp:Gridview>
    <asp:SqlDataSource id="dsAddresses" runat="server"
         SelectCommand="SELECT StateID FROM Addresses" />
    <asp:SqlDataSource id="dsStates" runat="server"
         SelectCommand="SELECT ID, Name FROM States" />
    There's a few properties left out that would make the ASP.NET example function properly but I feel that illustrates it pretty well.
  6. #6
  7. #7
    Thank you Vladimir it worked like a charm.

Similar Threads

  1. [CLOSED] Label Editor - Different Editor types
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Nov 29, 2013, 3:34 AM
  2. [CLOSED] How to get Cell ID or Row Index in Grid Panel with ComponentColumn
    By Digital.Dynamics in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 14, 2012, 11:58 AM
  3. ComponentColumn usage
    By Zdenek in forum 2.x Help
    Replies: 0
    Last Post: Jul 13, 2012, 9:38 AM
  4. Replies: 1
    Last Post: Nov 15, 2011, 5:56 AM
  5. [CLOSED] Label Editor ComboBox Jumps to left when Editor activated
    By IanPearce in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Sep 19, 2011, 1:31 PM

Posting Permissions