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

Using a RadCombobox inside RadGrid when editing

1 Answer 124 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 21 Sep 2012, 05:45 PM
Hi Everyone,

We just bought a couple of licenses for ASP.NET AJAX.

I would like to do the following :

- Reduce the time for my page to load cause inside my radCombobox, I have the name of 5000 person
- Have a radCombobox indise the edit part with automatic load on demand with max 30 items/request
- When I click edit, I would like the selectedValue to be the actual value it was before I clicked the edit command (actually, it's empty)

I'm using a SQLDataSource connected to a storedProc. It might not be the best way to do it, and I'm really
open to advice or suggestion to achieve my goal.

Thanks and have a great day !

Richard

This is my ASPX part
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="gestionScoreSheet.aspx.cs"
    Inherits="GestionV2_gestionScoreSheet" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <div id="sdsGrouping">
        <asp:SqlDataSource ID="sdsJoueurVisiteur" runat="server" ConnectionString="<%$ ConnectionStrings:DB_36624_hlm_ConnectionString %>"
            SelectCommand="SELECT tblPersonne.strNomPersonne + N', ' + tblPersonne.strPrenomPersonne AS strNomComplet, tblJoueurPosition.strNomPosition, tblSSSubEquipeSubJoueur.FKintIDJoueurPosition, tblSSSubEquipeSubJoueur.FKintIDPersonne, tblSSSubEquipe.intIDSSEquipe, tblSS.intIDSS, tblSS.FKintIDCedule, tblSSSubEquipe.FKintIDEquipe, tblSSSubEquipeSubJoueur.intIDSSJoueur, tblSSSubEquipeSubJoueur.ysnRegulier FROM tblSSSubEquipe INNER JOIN tblSS ON tblSSSubEquipe.FKintIDSS = tblSS.intIDSS INNER JOIN tblSSSubEquipeSubJoueur INNER JOIN tblPersonne ON tblSSSubEquipeSubJoueur.FKintIDPersonne = tblPersonne.intIDPersonne INNER JOIN tblJoueurPosition ON tblSSSubEquipeSubJoueur.FKintIDJoueurPosition = tblJoueurPosition.intIDJoueurPosition ON tblSSSubEquipe.intIDSSEquipe = tblSSSubEquipeSubJoueur.FKintIDSSEquipe WHERE (tblSSSubEquipe.FKintIDEquipe = @FKintIDEquipe) AND (tblSS.intIDSS = @intIDSS) ORDER BY strNomComplet"
            UpdateCommand="spScoreSheetLineUPUpdate" UpdateCommandType="StoredProcedure"
            DeleteCommand="spScoreSheetLineUPDelete" DeleteCommandType="StoredProcedure"
            InsertCommand="spScoreSheetLineUpInsert" InsertCommandType="StoredProcedure">
            <DeleteParameters>
                <asp:Parameter Name="intIDSSJoueur" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="intIDSS" Type="Int32" />
                <asp:Parameter Name="strRVSSEquipe" Type="String" />
                <asp:Parameter Name="FKintIDPersonne" Type="Int32" />
                <asp:Parameter Name="FKintIDJoueurPosition" Type="Int32" />
                <asp:Parameter Name="ysnRegulier" Type="Boolean" DefaultValue="False" />
            </InsertParameters>
            <SelectParameters>
                <asp:Parameter DefaultValue="2144395403" Name="FKintIDEquipe" />
                <asp:Parameter DefaultValue="2146239473" Name="intIDSS" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="intIDSSJoueur" Type="Int32" />
                <asp:Parameter Name="FKintIDPersonne" Type="Int32" />
                <asp:Parameter Name="FKintIDJoueurPosition" Type="Int32" />
                <asp:Parameter Name="ysnRegulier" Type="Boolean" DefaultValue="False" />
            </UpdateParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="sdsListePosition" runat="server" ConnectionString="<%$ ConnectionStrings:DB_36624_hlm_ConnectionString %>"
            SelectCommand="SELECT * FROM [tblJoueurPosition]"></asp:SqlDataSource>
        <%--sdsListePersonne select command = SELECT top (100) percent intIDPersonne, strNomPersonne + ', ' + strPrenomPersonne AS strNomComplet FROM tblPersonne order by strNomComplet--%>
        <asp:SqlDataSource ID="sdsListePersonne" runat="server" ConnectionString="<%$ ConnectionStrings:DB_36624_hlm_ConnectionString %>"
            SelectCommand="spListePersonne" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
        <br />
        <br />
        <div>
            <telerik:RadGrid ID="rGridLineUpVisiteur" runat="server" AutoGenerateColumns="False"
                CellSpacing="0" Culture="fr-FR" DataSourceID="sdsJoueurVisiteur" GridLines="None"
                AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
                AllowMultiRowEdit="True" AllowSorting="True" ShowFooter="True" AutoGenerateDeleteColumn="True"
                AutoGenerateEditColumn="True">
                <MasterTableView DataSourceID="sdsJoueurVisiteur" DataKeyNames="intIDSSJoueur" EditMode="InPlace"
                    CommandItemDisplay="TopAndBottom">
                    <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                    <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridTemplateColumn DataField="FKintIDPersonne" DataType="System.Int32" FilterControlAltText="Filter FKintIDPersonne column"
                            HeaderText="Name of person" SortExpression="FKintIDPersonne" UniqueName="FKintIDPersonne">
                            <EditItemTemplate>
                                <telerik:RadComboBox ID="radCombo_ListPerson" runat="server" Culture="fr-FR" DataSourceID="sdsListePersonne"
                                    AutoPostBack="true" DataTextField="strNomComplet" DataValueField="intIDPersonne"
                                    EnableAutomaticLoadOnDemand="true" ShowMoreResultsBox="true" EnableVirtualScrolling="true"
                                    ItemsPerRequest="30">
                                </telerik:RadComboBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblNamePerson" runat="server" Text='<%# Eval("strNomComplet") %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn DataField="FKintIDJoueurPosition" DataType="System.Int32"
                            FilterControlAltText="Filter FKintIDJoueurPosition column" HeaderText="Position of person"
                            SortExpression="FKintIDJoueurPosition" UniqueName="FKintIDJoueurPosition">
                        </telerik:GridBoundColumn>
                        <telerik:GridCheckBoxColumn DataField="ysnRegulier" DataType="System.Boolean" FilterControlAltText="Filter ysnRegulier column"
                            HeaderText="Full time player ?" SortExpression="ysnRegulier" UniqueName="ysnRegulier">
                        </telerik:GridCheckBoxColumn>
                    </Columns>
                    <EditFormSettings>
                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                        </EditColumn>
                    </EditFormSettings>
                </MasterTableView>
                <FilterMenu EnableImageSprites="False">
                </FilterMenu>
            </telerik:RadGrid>
        </div>
    </form>
</body>
</html>

1 Answer, 1 is accepted

Sort by
0
Accepted
Pavlina
Telerik team
answered on 27 Sep 2012, 10:16 AM
Hello Richard,

Straight to your questions:

Reduce the time for my page to load cause inside my radCombobox, I have the name of 5000 person
If you are dealing with large number of data, the best approach to optimize the performance speed of Telerik RadComboBox is using the load-on-demand feature. To achieve a faster loading speed you can also load portions of the combobox items in each ItemsRequested event handler by using ShowMoreResultsBox and the EnableVirtualScrolling properties .

- Have a radCombobox indise the edit part with automatic load on demand with max 30 items/request
As already said In order to load items on portions (let say by 30 etc.) instead of loading all Items matching the given text you can set the ShowMoreResultsBox property to true.A live example is available here:
http://demos.telerik.com/aspnet-ajax/combobox/examples/populatingwithdata/autocompletesql/defaultcs.aspx

-When I click edit, I would like the selectedValue to be the actual value it was before I clicked the edit command (actually, it's empty)
You can retrieve the old values for the edited item through the SavedOldValues property of the GridEditableItem(which is IDictionary collection of key -> value pairs). The keys in this collection are the UniqueNames of the editable columns and the values are the cell content for the edited row before the edit operation. More information is available in this help article:
http://www.telerik.com/help/aspnet-ajax/grid-retrieve-original-values-for-edited-item.html

Greetings,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Richard
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or