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

Radcombo box more than 2000 record binded in gridview .Not working

4 Answers 50 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
nanthakumar thangavel
Top achievements
Rank 1
nanthakumar thangavel asked on 07 Aug 2010, 08:42 AM

I Placed three Radcombo Box in Grid View  and also binded  more than 2000 records to combo box.
after that i click Edit Button in grid view its show Edit template when i selected the combobox item it's hanging...

4 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 10 Aug 2010, 09:42 AM
Hi nanthakumar thangavel,

Have you used the load-on-demand feature for the combobox? Please take a look at this help topic for optimizing the RadCombobox speed.

Also you can look at this demo for an example of RadComboBox in Grid.

If you still have problems please send us the full code so we can inspect it and help you.

Best Regards,
Veronica Milcheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
nanthakumar thangavel
Top achievements
Rank 1
answered on 13 Aug 2010, 10:38 AM
i tried the above step but till taking more time and hanging..

This is my code
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="UcAddressDetail.ascx.vb"
    Inherits="Aspen.UcAddressDetail" %>
<%@ Register Assembly="Aspen" Namespace="Aspen" TagPrefix="cc1" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
 
    <script type="text/javascript">
    function RowDblClick(sender, eventArgs)
    {
        window.radopen("View/AddressView.aspx?ID=" + eventArgs.getDataKeyValue("Id") , "RadView1");
    }
    
    </script>
 
</telerik:RadCodeBlock>
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
    <ClientEvents OnRequestStart="requestStart" />
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="Grd_Address">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="Grd_Address" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<cc1:SHRadGrid ID="Grd_Address" runat="server" GridLines="None" AutoGenerateColumns="False"
    Width="60%">
    <ExportSettings ExportOnlyData="True" FileName="Address_List">
    </ExportSettings>
    <PagerStyle Position="TopAndBottom" />
    <MasterTableView CommandItemDisplay="TopAndBottom" EditMode="PopUp" DataKeyNames="Id, ID_Org, ID_StateProv, ID_Country"
        ClientDataKeyNames="Id">
        <RowIndicatorColumn Visible="True">
        </RowIndicatorColumn>
        <Columns>
            <telerik:GridEditCommandColumn UniqueName="EditColumn" ButtonType="ImageButton" EditImageUrl="~/images/EditRecord.gif">
                <ItemStyle Width="5%" />
            </telerik:GridEditCommandColumn>
            <telerik:GridButtonColumn UniqueName="DeleteColumn" ButtonType="ImageButton" CommandName="Delete"
                ImageUrl="~/images/DeleteRecord.gif" ConfirmText="Are you sure to delete?">
                <ItemStyle Width="5%" />
            </telerik:GridButtonColumn>
            <telerik:GridBoundColumn UniqueName="Name" DataField="Latitude" HeaderText="Latitude"
                SortExpression="Latitude" ColumnEditorID="GridTextBoxColumnEditor2" AutoPostBackOnFilter="true">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Longitude" HeaderText="Longitude" UniqueName="column1">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Street1" HeaderText="Street1" SortExpression="Street1"
                UniqueName="column2">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Street2" HeaderText="Street2" SortExpression="Street2"
                UniqueName="column3">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="City" HeaderText="City" SortExpression="City"
                UniqueName="column">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="PostCode" HeaderText="Postal Code" SortExpression="PostCode"
                UniqueName="column4">
            </telerik:GridBoundColumn>
        </Columns>
        <EditFormSettings EditFormType="Template" PopUpSettings-Modal="true" CaptionFormatString="Address Detail">
            <EditColumn UniqueName="EditCommandColumn1">
            </EditColumn>
            <FormTemplate>
                <fieldset>
                    <legend>Longitude</legend>
                    <telerik:RadTextBox ID="txtLatitude" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Latitude") %>'
                        Width="200px">
                    </telerik:RadTextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*"
                        ControlToValidate="txtLatitude" ValidationGroup="add">
                    </asp:RequiredFieldValidator>
                </fieldset>
                <fieldset>
                    <legend>Latitude</legend>
                    <telerik:RadTextBox ID="RadTextBox1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Latitude") %>'
                        Width="200px">
                    </telerik:RadTextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="*"
                        ControlToValidate="txtLatitude" ValidationGroup="add">
                    </asp:RequiredFieldValidator>
                </fieldset>
                <fieldset>
                    <legend>Longitude</legend>
                    <telerik:RadTextBox ID="txtLongitude" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Longitude") %>'
                        Width="200px">
                    </telerik:RadTextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="*"
                        ControlToValidate="txtLongitude" ValidationGroup="add">
                    </asp:RequiredFieldValidator>
                </fieldset>
                <fieldset>
                    <legend>Street 1</legend>
                    <telerik:RadTextBox ID="txtStreet1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Street1") %>'
                        Width="200px">
                    </telerik:RadTextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="*"
                        ControlToValidate="txtStreet1" ValidationGroup="add">
                    </asp:RequiredFieldValidator>
                </fieldset>
                <fieldset>
                    <legend>Street 2</legend>
                    <telerik:RadTextBox ID="txtStreet2" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Street2") %>'
                        Width="200px">
                    </telerik:RadTextBox>
                </fieldset>
                <fieldset>
                    <legend>City</legend>
                    <telerik:RadTextBox ID="txtCity" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.City") %>'>
                    </telerik:RadTextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="*"
                        ControlToValidate="txtCity" ValidationGroup="add">
                    </asp:RequiredFieldValidator>
                </fieldset>
                <fieldset>
                    <legend>PostCode</legend>
                    <telerik:RadTextBox ID="txtPostalCode" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.PostCode") %>'>
                    </telerik:RadTextBox>
                </fieldset>
                <fieldset>
                    <legend>Org</legend>
                    <telerik:RadComboBox ID="rcbOrg" runat="server" DataTextField="Name" DataValueField="ID" EnableLoadOnDemand="true">
                    </telerik:RadComboBox>
                </fieldset>
                <fieldset>
                    <legend>Country</legend>
                    <telerik:RadComboBox ID="rcbCountry" runat="server" DataTextField="Name" DataValueField="ID" EnableLoadOnDemand="true" >
                    </telerik:RadComboBox>
                </fieldset>
                <fieldset>
                    <legend>State</legend>
                    <telerik:RadComboBox ID="rcbState" runat="server" DataTextField="Name" DataValueField="ID" EnableLoadOnDemand="true" >
                    </telerik:RadComboBox>
                </fieldset>
                <fieldset>
                    <legend>Action</legend>
                    <asp:LinkButton ID="btnUpdate" runat="server" CommandName='<%# Iif (TypeOf Container is GridEditFormInsertItem, "PerformInsert", "Update") %>'
                        Text='<%# Iif (TypeOf Container is GridEditFormInsertItem, "Insert", "Update") %>'
                        ValidationGroup="add" />
                    <asp:LinkButton ID="btnCancel" runat="server" CausesValidation="False" CommandName="Cancel"
                        Text="Cancel" />
                </fieldset>
            </FormTemplate>
        </EditFormSettings>
        <PagerStyle Position="TopAndBottom" />
        <CommandItemTemplate>
            <asp:Literal ID="Literal1" runat="server" Text="<table class="style1" width="100%"><tr><td>"></asp:Literal>
            <asp:LinkButton runat="server" CommandName="InitInsert" ID="addButton"> <img alt='' src='images/AddRecord.gif' style='border:0px;vertical-align:middle;' /> Add New Record </asp:LinkButton>
            <asp:Literal ID="Literal2" runat="server" Text="</td><td style="text-align: right">"></asp:Literal>
            <asp:LinkButton runat="server" ID="refreshButton"> <img alt='' src='images/Refresh.gif' style='border:0px;vertical-align:middle;' /> Refresh </asp:LinkButton>
            <asp:LinkButton runat="server" CommandName="Show Hide Filter" ID="showhideFilterButton"> <img alt='' src='images/Filter.png' style='border:0px;vertical-align:middle;' /> Show/Hide Filter </asp:LinkButton>
            <asp:LinkButton runat="server" CommandName="Save Settings" ID="saveSettingsButton"> <img alt='' src='images/Settings.png' style='border:0px;vertical-align:middle;' /> Save Settings </asp:LinkButton>
            <telerik:RadComboBox runat="server" AutoPostBack="True" EnableLoadOnDemand="True"
                OnClientDropDownClosed="ResetValue" Width="80px" EnableViewState="False" ID="cboExport">
                <Items>
                    <telerik:RadComboBoxItem runat="server" Text="Export To" Value="Export To"></telerik:RadComboBoxItem>
                    <telerik:RadComboBoxItem runat="server" Text="EXCEL" Value="EXCEL"></telerik:RadComboBoxItem>
                    <telerik:RadComboBoxItem runat="server" Text="CSV" Value="CSV"></telerik:RadComboBoxItem>
                </Items>
            </telerik:RadComboBox>
            <asp:Literal ID="Literal3" runat="server" Text="&nbsp;</td></tr></table>"></asp:Literal>
        </CommandItemTemplate>
    </MasterTableView>
</cc1:SHRadGrid>
<telerik:RadWindowManager ID="RadWindowManager1" runat="server">
    <Windows>
        <telerik:RadWindow ID="RadView1" runat="server" Title="HelpTopic View" Height="300px"
            Width="300px" Left="150px" ReloadOnShow="true" ShowContentDuringLoad="False"
            Modal="true" Animation="Fade" Skin="Vista" VisibleStatusbar="False" />
    </Windows>
</telerik:RadWindowManager>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Vista">
</telerik:RadAjaxLoadingPanel>
 
 
 
 
 
Imports SHAPI.SHSafeNull
Imports Telerik.Web.UI
Partial Public Class UcAddressDetail
    Inherits System.Web.UI.UserControl
 
    Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try
            If Not IsPostBack Then
                Session("UserId") = GetNumeric(Request("UserId"))
 
            End If
        Catch ex As Exception
            Response.Write(ex.Message)
        End Try
    End Sub
    Private Function GetOrganization() As DataTable
        Try
            Dim obj As Object = Me.Session("Organization")
            If (Not obj Is Nothing) Then
                GetOrganization = CType(obj, DataTable)
            End If
        Catch ex As Exception
            Throw ex
        End Try
    End Function
    Private Function GetState() As DataTable
        Try
            Dim obj As Object = Me.Session("State")
            If (Not obj Is Nothing) Then
                GetState = CType(obj, DataTable)
            End If
 
        Catch ex As Exception
            Throw ex
        End Try
    End Function
    Private Function Getcountry() As DataTable
        Try
            Dim obj As Object = Me.Session("Country")
            If (Not obj Is Nothing) Then
                Getcountry = CType(obj, DataTable)
            End If
        Catch ex As Exception
            Throw ex
        End Try
    End Function
    Private Function GetAddress() As DataTable
        Dim o As DAL_Address
        Try
            o = New DAL_Address
            GetAddress = o.List()
 
 
            'Load Country Table
            Dim objCountry As Object = Me.Session("Country")
            If (objCountry Is Nothing) Then
                Dim myDataTable As DataTable = New DataTable
                myDataTable = o.GetCountry()
                Me.Session("Country") = myDataTable
            End If
 
            'Load State Table
            Dim objState As Object = Me.Session("State")
            If (objState Is Nothing) Then
                Dim myDataTable As DataTable = New DataTable
                myDataTable = o.GetState()
                Me.Session("State") = myDataTable
            End If
 
            'Load Organization Table
            Dim objOrganization As Object = Me.Session("Organization")
            If (objOrganization Is Nothing) Then
                Dim myDataTable As DataTable = New DataTable
                myDataTable = o.GetOrganization()
                Me.Session("Organization") = myDataTable
            End If
 
            o.Dispose()
        Catch ex As Exception
            Throw ex
        Finally
            o = Nothing
        End Try
    End Function
 
    Private Sub Grd_Address_DeleteCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles Grd_Address.DeleteCommand
        Dim o As DAL_Address
        Try
            Dim Itm As GridItem = CType(e.Item, GridItem)
            Dim ID As Integer = GetNumeric(Itm.OwnerTableView.DataKeyValues(Itm.ItemIndex)("Id"))
            o = New DAL_Address
            o.Delete(ID)
            o.Dispose()
 
        Catch ex As Exception
            Response.Write(ex.Message)
        Finally
            o = Nothing
        End Try
    End Sub
 
    Private Sub Grd_Address_InsertCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles Grd_Address.InsertCommand
        Dim o As New DAL_Address
        Try
 
            Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)
            Dim values As New Hashtable()
            editedItem.ExtractValues(values)
 
 
 
 
 
            Dim txtLatitude As RadTextBox = editedItem.FindControl("txtLatitude")
            Dim txtLongitude As RadTextBox = editedItem.FindControl("txtLongitude")
            Dim txtStreet1 As RadTextBox = editedItem.FindControl("txtStreet1")
            Dim txtStreet2 As RadTextBox = editedItem.FindControl("txtStreet2")
            Dim txtCity As RadTextBox = editedItem.FindControl("txtCity")
            Dim txtPostalCode As RadTextBox = editedItem.FindControl("txtPostalCode")
            Dim rcbOrg As RadComboBox = DirectCast(editedItem.FindControl("rcbOrg"), RadComboBox)
            Dim rcbCountry As RadComboBox = DirectCast(editedItem.FindControl("rcbCountry"), RadComboBox)
            Dim rcbState As RadComboBox = DirectCast(editedItem.FindControl("rcbState"), RadComboBox)
 
            o.Data.Latitude = IIf(txtLatitude Is Nothing, "", GetString(txtLatitude.Text))
            o.Data.Longitude = IIf(txtLongitude Is Nothing, "", GetString(txtLongitude.Text))
            o.Data.Street1 = IIf(txtStreet1 Is Nothing, "", GetString(txtStreet1.Text))
            o.Data.Street2 = IIf(txtStreet2 Is Nothing, "", GetString(txtStreet2.Text))
            o.Data.City = IIf(txtCity Is Nothing, "", GetString(txtCity.Text))
            o.Data.PostCode = IIf(txtPostalCode Is Nothing, "", GetString(txtPostalCode.Text))
            o.Data.ID_Org = GetNumeric(rcbOrg.SelectedValue)
            o.Data.ID_StateProv = GetNumeric(rcbState.SelectedValue)
            o.Data.ID_Country = GetNumeric(rcbCountry.SelectedValue)
            o.Insert()
            o.Dispose()
 
        Catch ex As Exception
            Response.Write(ex.Message)
            o = Nothing
            e.Canceled = True
        End Try
    End Sub
 
    
 
    Private Sub Grd_Address_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles Grd_Address.ItemDataBound
        Try
            If TypeOf e.Item Is GridEditFormItem AndAlso e.Item.IsInEditMode Then
                Dim editForm As GridEditFormItem = DirectCast(e.Item, GridEditFormItem)
 
                Dim rcbOrg As RadComboBox = DirectCast(editForm.FindControl("rcbOrg"), RadComboBox)
                Dim rcbCountry As RadComboBox = DirectCast(editForm.FindControl("rcbCountry"), RadComboBox)
                Dim rcbState As RadComboBox = DirectCast(editForm.FindControl("rcbState"), RadComboBox)
 
 
                rcbOrg.DataSource = GetOrganization()
                rcbOrg.DataBind()
 
                'rcbOrg.SelectedValue = editForm.GetDataKeyValue("ID_Org").ToString()
 
 
                rcbCountry.DataSource = Getcountry()
                rcbCountry.DataBind()
 
                'rcbCountry.SelectedValue = editForm.GetDataKeyValue("ID_Country").ToString()
 
 
 
                rcbState.DataSource = GetState()
                rcbState.DataBind()
 
                'rcbState.SelectedValue = editForm.GetDataKeyValue("ID_StateProv").ToString()
            End If
        Catch ex As Exception
            Response.Write(ex.Message)
        End Try
 
 
    End Sub
 
    Private Sub Grd_Address_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles Grd_Address.NeedDataSource
        Try
            Me.Grd_Address.DataSource = GetAddress()
        Catch ex As Exception
            Response.Write(ex.Message)
        End Try
    End Sub
 
    Private Sub Grd_Address_UpdateCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles Grd_Address.UpdateCommand
        Dim o As DAL_Address
        Try
            Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)
            Dim txtLatitude As RadTextBox = editedItem.FindControl("txtLatitude")
            Dim txtLongitude As RadTextBox = editedItem.FindControl("txtLongitude")
            Dim txtStreet1 As RadTextBox = editedItem.FindControl("txtStreet1")
            Dim txtStreet2 As RadTextBox = editedItem.FindControl("txtStreet2")
            Dim txtCity As RadTextBox = editedItem.FindControl("txtCity")
            Dim txtPostalCode As RadTextBox = editedItem.FindControl("txtPostalCode")
            Dim rcbOrg As RadComboBox = DirectCast(editedItem.FindControl("rcbOrg"), RadComboBox)
            Dim rcbCountry As RadComboBox = DirectCast(editedItem.FindControl("rcbCountry"), RadComboBox)
            Dim rcbState As RadComboBox = DirectCast(editedItem.FindControl("rcbState"), RadComboBox)
 
            o = New DAL_Address
            o.Data.Id = editedItem.OwnerTableView.DataKeyValues(editedItem.ItemIndex)("Id")
            o.Data.Latitude = IIf(txtLatitude Is Nothing, "", GetString(txtLatitude.Text))
            o.Data.Longitude = IIf(txtLongitude Is Nothing, "", GetString(txtLongitude.Text))
            o.Data.Street1 = IIf(txtStreet1 Is Nothing, "", GetString(txtStreet1.Text))
            o.Data.Street2 = IIf(txtStreet2 Is Nothing, "", GetString(txtStreet2.Text))
            o.Data.City = IIf(txtCity Is Nothing, "", GetString(txtCity.Text))
            o.Data.PostCode = IIf(txtPostalCode Is Nothing, "", GetString(txtPostalCode.Text))
            o.Data.ID_Org = GetNumeric(rcbOrg.SelectedValue)
            o.Data.ID_StateProv = GetNumeric(rcbState.SelectedValue)
            o.Data.ID_Country = GetNumeric(rcbCountry.SelectedValue)
            o.Update()
            o.Dispose()
        Catch ex As Exception
            Response.Write(ex.Message)
            e.Canceled = True
        Finally
            o = Nothing
        End Try
    End Sub
 
    
End Class



0
Veronica
Telerik team
answered on 16 Aug 2010, 03:09 PM
Hello nanthakumar thangavel,

I see you are using the load-on-demand feature. For even faster load of the page, you can leave the combobox empty when it is first rendered on the page. Items will be added as soon as the user clicks in the input field, the drop-arrow image or types some text into the input field. In other words, you can add the items only in the ItemsRequested event handler or via WebService.

Kind regards,
Veronica Milcheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
nanthakumar thangavel
Top achievements
Rank 1
answered on 19 Aug 2010, 05:45 AM
Hi 

I want another things regarding Combo Box...if i select Country  rad combo  in edit popup window (radgrid) and load state radcombox based selected country 

Thanks 
Tags
PanelBar
Asked by
nanthakumar thangavel
Top achievements
Rank 1
Answers by
Veronica
Telerik team
nanthakumar thangavel
Top achievements
Rank 1
Share this question
or