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

on ItemsRequested is not working in Combo box

1 Answer 116 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Rakesh
Top achievements
Rank 1
Rakesh asked on 31 Oct 2008, 01:38 PM
Hi,
when i click on rad combo box it is not working meand it is not fill data in Combo box  it give the error: "RadComboBox:Server error in the itemRequested event handler" . I am using Asp.net 3.5 with Linq to sql .

Code Below:

<rad:RadComboBox Width="300px" Height="80px" ID="RadComboBox1" runat="server"
                                HighlightTemplatedItems="True" DataTextField="Title" TabIndex="1" ItemRequestTimeout="2" EnableLoadOnDemand="true"
                                DataValueField="ServiceRequermentID" MarkFirstMatch="True" ExpandEffect="Blinds" OnItemsRequested="RadComboBox1_ItemsRequested"
                                SkinsPath="~/RadControls/ComboBox/Skins" LoadingMessage="Your ServiceRequerment is Loading..."
                                AccessKey="T" AllowCustomText="True" AutoCompleteSeparator="&quot;;&quot;, &quot;,&quot;, "
                                ErrorMessage="ServiceRequerment are not Avilable" NoWrap="True" ShowMoreResultsBox="True">
                                <ItemTemplate>
                                    <table>
                                        <tr>
                                           
                                            <td>
                                                <asp:Label ID="lbl" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Title")%>'></asp:Label>
                                            </td>
                                        </tr>
                                    </table>
                                </ItemTemplate>
                            </rad:RadComboBox>



protected void RadComboBox1_SelectedIndexChanged(object o, Telerik.WebControls.RadComboBoxSelectedIndexChangedEventArgs e)
    {
        if (RadComboBox1.SelectedItem != null)
            RadComboBox1.Text = RadComboBox1.SelectedItem.Text;
           
    }
    protected void RadComboBox1_ItemsRequested(object o, Telerik.WebControls.RadComboBoxItemsRequestedEventArgs e)
    {
        //string match=RadComboBox1.Text.ToString();

        fillRadcombobox();
    }
    public void fillRadcombobox()
    {
       
        Guid UserRequermentID =getdate.GetUserRequermentID();
        var ServiceRequerment = from service in db.ServiceRequerments where service.UserRequermentID == UserRequermentID select service;
        var servicedata = ServiceRequerment.ToList();
        if (servicedata.Count > 0)
        {
            RadComboBox1.DataSource = servicedata;
            RadComboBox1.DataBind();
        }
    }


Plz its Urgent
Rakesh Gupta

1 Answer, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 03 Nov 2008, 11:47 AM
Hello Rakesh,

This error means that your code in the ItemsRequested event throws an exception.

I suggest you test this code outside the ItemsRequested event and see what the problem is.

Regards,
Rosi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
Rakesh
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Share this question
or