RadComboBox in EditFormSettings - how to find it ?

7 posts, 0 answers
  1. Krzysztof
    Krzysztof avatar
    29 posts
    Member since:
    Aug 2008

    Posted 11 Dec 2008 Link to this post

    Hi

    I have code :
    <telerik:RadGrid ID="GridAdvert" runat="server" > 
             <MasterTableView DataKeyNames="id" >                        
               <EditFormSettings EditFormType="Template"  > 
                <EditColumn UniqueName="EditCommandColumn1">   
                </EditColumn>        
                 <FormTemplate> 
                     
                      <telerik:RadComboBox ID="findCompanyBox" runat="server" Skin="Inox"               
                        AllowCustomText="True" ShowToggleImage="True" ShowMoreResultsBox="true" 
                        EnableLoadOnDemand="True" EnableVirtualScrolling="true"   
                        Width="200px" Height="200px"   
                        ZIndex="10000" OnItemsRequested="findCompanyBox_ItemsRequested" > 
                        <CollapseAnimation Duration="200" Type="OutQuint" /> 
                      </telerik:RadComboBox>                    
     
                 <asp:Button ID="UpdateButton" OnClientClick="Save(this, event);" Text="Save"   
                        runat="server" /> 
                </FormTemplate>                                                  
               </EditFormSettings>                    
              </MasterTableView> 
             </telerik:RadGrid> 

    in code behind I have :

    protected void findCompanyBox_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)  
    {  
       RadComboBox findCompanyBox = new RadComboBox();  
       findCompanyBox = (RadComboBox)GridAdvert.FindControl("findCompanyBox");  


    After I call :
    findCompanyBox = (RadComboBox)GridAdvert.FindControl("findCompanyBox");
    ... I get > findCompanyBox = null

    My question is . How can I find RadComboBox control in Girid FormTemplate ???

    Regards
    Krzysztof






  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 11 Dec 2008 Link to this post

    Hello,

    You can try the following code to access the RadComboBox in Grid EditFormTemplate in the ItemDataBound event of the RadGrid.
    cs:
    protected void GridAdvert_ItemDataBound(object sender, GridItemEventArgs e) 
        { 
           if (e.Item is GridEditFormItem && e.Item.IsInEditMode) 
              {             
                  GridEditFormItem item = e.Item as GridEditFormItem; 
                  RadComboBox  rdcbx = (RadComboBox )item.FindControl("findCompanyBox") 
              } 
        } 

    Thanks
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Krzysztof
    Krzysztof avatar
    29 posts
    Member since:
    Aug 2008

    Posted 12 Dec 2008 Link to this post

    Hi

    It work well. Thank You.
    But I have another problem with display RadComboBox items.

    I code behind I have :

    protected void findCompanyBox_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)  
        {  
    for (int i = itemOffset; i < endOffset; i++)  
     {  
        RadComboBoxItem boxItem =  
                        new RadComboBoxItem(data.Rows[i]["companyName"].ToString(), data.Rows[i]["companyName"].ToString());  
        boxItem.Font.Size = FontUnit.Point(8);  
        FindCompanyBox.Items.Add(boxItem);  
     
      }  

    When I match items for ComboBox, I canot see the items. I can see border and footer of ComboBox but item content disapear. I cannot see background of items too.  Why ??

    Regards
    Krzysztof

  5. Krzysztof
    Krzysztof avatar
    29 posts
    Member since:
    Aug 2008

    Posted 12 Dec 2008 Link to this post

    Hi

    C# code work well but ...
    How can I find RadComboBox in JavaScript code ???

    Regrards
    Krzysztof
  6. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 12 Dec 2008 Link to this post

    Hi Krzysztof,

    Here is a code library submission which explains how to access controls in a Grid template on the client side. Go through it and see if it helps to some extent.
    Accessing server controls in a grid template on the client

    Shinu.
  7. Krzysztof
    Krzysztof avatar
    29 posts
    Member since:
    Aug 2008

    Posted 12 Dec 2008 Link to this post

    Hi

    Thank You for the sample.

    Could You answer for my prevoiuse question ??

    .....
    When I match items for ComboBox, I canot see the items. I can see border and footer of ComboBox but item content disapear. I cannot see background of items too.  Why ??
    .....

    Regards
    Krzysztof
  8. Krzysztof
    Krzysztof avatar
    29 posts
    Member since:
    Aug 2008

    Posted 12 Dec 2008 Link to this post

    Hi

    I downloaded and run this sample. It work well.


    Regards
    Krzysztof
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017