This is a migrated thread and some comments may be shown as answers.

RadComboBox in EditFormSettings - items not visible

8 Answers 276 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Krzysztof
Top achievements
Rank 1
Krzysztof asked on 13 Dec 2008, 09:01 PM
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


8 Answers, 1 is accepted

Sort by
0
Krzysztof
Top achievements
Rank 1
answered on 16 Dec 2008, 09:02 AM
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
0
Iana Tsolova
Telerik team
answered on 16 Dec 2008, 11:58 AM
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.
0
Krzysztof
Top achievements
Rank 1
answered on 16 Dec 2008, 12:24 PM
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
0
Iana Tsolova
Telerik team
answered on 16 Dec 2008, 03:47 PM
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.
0
Krzysztof
Top achievements
Rank 1
answered on 18 Dec 2008, 03:25 PM
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
0
Iana Tsolova
Telerik team
answered on 20 Dec 2008, 12:22 PM
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.
0
Krzysztof
Top achievements
Rank 1
answered on 20 Dec 2008, 07:26 PM
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
0
Yana
Telerik team
answered on 22 Dec 2008, 11:51 AM
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.
Tags
Grid
Asked by
Krzysztof
Top achievements
Rank 1
Answers by
Krzysztof
Top achievements
Rank 1
Iana Tsolova
Telerik team
Yana
Telerik team
Share this question
or