RadComboBox in EditFormSettings - items not visible

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

    Posted 13 Dec 2008 Link to this post

    Hi

    I have code like :
    <telerik:RadGrid ID="GridAdvert" runat="server"  PageSize="5" OnItemDataBound="GridAdvert_ItemDataBound" 
      OnNeedDataSource="GridAdvert_NeedDataSource"   >
     
    <MasterTableView DataKeyNames="id"   
                 EditMode="PopUp">  
     
    <EditFormSettings EditFormType="Template"   PopUpSettings-ZIndex="200">  
                <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"   
                        Text='<%# DataBinder.Eval( Container, "DataItem.companyName" ) %>' 
                        ZIndex="1000" OnItemsRequested="findCompanyBox_ItemsRequested" > 
                        <CollapseAnimation Duration="200" Type="OutQuint" /> 
                      </telerik:RadComboBox>    
     
    In code behind I have :

    RadComboBox FindCompanyBox = new RadComboBox();  
     
    protected void GridAdvert_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)  
        {  
                    if (e.Item is GridEditFormItem && e.Item.IsInEditMode)    
              {                
                  GridEditFormItem item = e.Item as GridEditFormItem;  
                  FindCompanyBox = (RadComboBox)item.FindControl("findCompanyBox");  
              }    
     
        }  
     
    protected void findCompanyBox_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)  
        {  
            if (e.Text.Length < 3) return;  
     
     
            String ConnString =  
                        "Provider=Microsoft.Jet.OLEDB.4.0;" +  
                        "Data Source=c:\\DataFile.mdb;" +  
                        "User Id=admin;Password=;";  
            OleDbConnection conn = new OleDbConnection(ConnString);  
            DataSet simData = new DataSet();  
            String query =  
                "SELECT id , companyName " +  
                "FROM Company  " +  
                "WHERE UCASE(companyName) LIKE UCASE('%" + e.Text + "%') " +  
                "ORDER BY id ";  
            OleDbCommand command = new OleDbCommand(query, conn);  
            OleDbDataAdapter adapter = new OleDbDataAdapter(command);  
            conn.Open();  
            adapter.Fill(simData, "Company");  
            conn.Close();  
     
            DataTable data = new DataTable();  
            data = simData.Tables[0];  
     
            int ile = data.Rows.Count;  
     
            try  
            {  
     
                int itemsPerRequest = 10;  
                int itemOffset = e.NumberOfItems;  
                int endOffset = itemOffset + itemsPerRequest;  
                if (endOffset > data.Rows.Count)  
                {  
                    endOffset = data.Rows.Count;  
                }  
                if (endOffset == data.Rows.Count)  
                {  
                    e.EndOfItems = true;  
                }  
                else  
                {  
                    e.EndOfItems = false;  
                }  
     
     
                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);  
     
                }  
     
                if (data.Rows.Count > 0)  
                {  
                    e.Message = String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset.ToString(), data.Rows.Count.ToString());  
                }  
                else  
                {  
                    e.Message = "No matches";  
                }  
            }  
            catch  
            {  
                e.Message = "No matches";  
            }  
     
        } 

    And the problem is :

    If I mach data from database to RadComboBox, the lines witch data disapear after loaded.
    If I move RadComboBox outside of RadGrid and insted of :
      GridEditFormItem item = e.Item as GridEditFormItem;  
      FindCompanyBox = (RadComboBox)item.FindControl("findCompanyBox");

    I call simply :
      findCompanyBox.Items.Add(boxItem);
    without finding component, everything work well .

    Where is the solution ??

    Regards
    Krzysztof


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

    Posted 16 Dec 2008 Link to this post

    Hi

    Could You evaluate this problem ?? I still have no answer for my question.
    It is important for me. I need this solution for my current project .

    Regards
    Krzysztof
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 16 Dec 2008 Link to this post

    Hello Krzysztof,

    Could you please try changing your code as below and let me know if it makes any difference:

    protected void findCompanyBox_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)  
    {  
        RadComboBox FindCompanyBox = o as RadComboBox;  
        if (e.Text.Length < 3) return;  
     
        String ConnString =  
                    "Provider=Microsoft.Jet.OLEDB.4.0;" +  
                    "Data Source=c:\\DataFile.mdb;" +  
                    "User Id=admin;Password=;";  
        OleDbConnection conn = new OleDbConnection(ConnString);  
        DataSet simData = new DataSet();  
        String query =  
            "SELECT id , companyName " +  
            "FROM Company  " +  
            "WHERE UCASE(companyName) LIKE UCASE('%" + e.Text + "%') " +  
            "ORDER BY id ";  
        OleDbCommand command = new OleDbCommand(query, conn);  
        OleDbDataAdapter adapter = new OleDbDataAdapter(command);  
        conn.Open();  
        adapter.Fill(simData, "Company");  
        conn.Close();  
     
        DataTable data = new DataTable();  
        data = simData.Tables[0];  
     
        int ile = data.Rows.Count;  
     
        try 
        {  
     
            int itemsPerRequest = 10;  
            int itemOffset = e.NumberOfItems;  
            int endOffset = itemOffset + itemsPerRequest;  
            if (endOffset > data.Rows.Count)  
            {  
                endOffset = data.Rows.Count;  
            }  
            if (endOffset == data.Rows.Count)  
            {  
                e.EndOfItems = true;  
            }  
            else 
            {  
                e.EndOfItems = false;  
            }  
     
     
            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);  
     
            }  
     
            if (data.Rows.Count > 0)  
            {  
                e.Message = String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset.ToString(), data.Rows.Count.ToString());  
            }  
            else 
            {  
                e.Message = "No matches";  
            }  
        }  
        catch 
        {  
            e.Message = "No matches";  
        }  
    }   


    Best wishes,
    Iana
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Krzysztof
    Krzysztof avatar
    29 posts
    Member since:
    Aug 2008

    Posted 16 Dec 2008 Link to this post

    Hi

    Thank You for responce.
    This code help a little bit. RadComboBox show lines with data. But if count of data records are less then empty spaces in control, I have transparent whole in ComboBox below lines witch data. It look bad. When lines of data are more then spaces in ComboBox, everything work well.

    Could You fix this problem ??

    Regards
    Krzysztof
  6. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 16 Dec 2008 Link to this post

    Hi Krzysztof,

    Could you please open a formal support ticket and send us a sample project illustrating the described behavior? Thus I could better understand your scenario and the issues you are facing in order to provide a proper solution for your case.

    Looking forward your reply,
    Iana
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  7. Krzysztof
    Krzysztof avatar
    29 posts
    Member since:
    Aug 2008

    Posted 18 Dec 2008 Link to this post

    Hi

    I found the reason of my problems.
    In simple code below under 3 items, I get transparent space.
    If I change skin for "Gray" or ather one everything work well.

    I thing, that the problem is in "Inox" style for RadComboBox.

    <body style="background-color:Yellow;">
    ......

    <
    telerik:RadComboBox ID="combo2" runat="server" Skin="Inox"               
                        AllowCustomText="True" ShowToggleImage="True" ShowMoreResultsBox="false" 
                        EnableLoadOnDemand="True" EnableVirtualScrolling="true"   
                        Width="230px" Height="200px"   
                        ZIndex="10000" AccessibilityMode="True"   
                         > 
                        <CollapseAnimation Duration="200" Type="OutQuint" /> 
                        <Items> 
                        <telerik:RadComboBoxItem Text="Item 1" Value="1" runat="server" /> 
                        <telerik:RadComboBoxItem Text="Item 2" Value="2" runat="server" /> 
                        <telerik:RadComboBoxItem Text="Item 3" Value="3" runat="server" /> 
                        </Items>                      
    </telerik:RadComboBox>  

    Regards
    Krzysztof
  8. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 20 Dec 2008 Link to this post

    Hello Krzysztof,

    Can you try removing the Height property setting of the combobox and let me know if this works for you:

    <telerik:RadComboBox ID="combo2" runat="server" Skin="Vista" AllowCustomText="True" 
        ShowToggleImage="True" ShowMoreResultsBox="false" EnableLoadOnDemand="True" EnableVirtualScrolling="true" 
        Width="230px" ZIndex="10000" AccessibilityMode="True">  
        <CollapseAnimation Duration="200" Type="OutQuint" /> 
        <Items> 
            <telerik:RadComboBoxItem Text="Item 1" Value="1" runat="server" /> 
            <telerik:RadComboBoxItem Text="Item 2" Value="2" runat="server" /> 
            <telerik:RadComboBoxItem Text="Item 3" Value="3" runat="server" /> 
        </Items> 
    </telerik:RadComboBox> 

    All the best,
    Iana
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  9. Krzysztof
    Krzysztof avatar
    29 posts
    Member since:
    Aug 2008

    Posted 20 Dec 2008 Link to this post

    Hi

    It work well (without Height property) but ...

    I would like to have comboBox with static height (not depent from number of items). I can see diference betwen "inox" and "gray" skin. In "Inox" I have transparent rectangle under last itam, in Gray I have colored background (not transparent) rectangle under last item. I thing, in "Inox" skin comboBox show itself wrong.

    Regards
    Krzysztof
  10. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 22 Dec 2008 Link to this post

    Hi Krzysztof,

    Please add the following css style to your page  in order to fix this issue:

    <style type="text/css">  
        div.RadComboBoxDropDown_Inox .rcbScroll {  
          background:#EFEFEF url(bg.jpeg) repeat scroll 0 0;  
        }  
    </style> 

    The used image is attached to the ticket.

    Best regards,
    Yana
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017