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

Google Suggest in Edit Mode Help Needed

1 Answer 23 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David OBrien
Top achievements
Rank 1
David OBrien asked on 18 Jul 2012, 05:29 PM
I have a database with some tables in it
the main table which is basically structured as such:


uid, existingpkg, win7preferredpackageid 
1, 100, 1200

I also have a lookup table which contains
uid, packagename
100, "Package One"
1200, "New Package One"



I have implmented a radgrid as follows


<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
  <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    <Scripts>
      <%--Needed for JavaScript IntelliSense in VS2010--%>
      <%--For VS2008 replace RadScriptManager with ScriptManager--%>
      <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
      <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
      <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
    </Scripts>
  </telerik:RadScriptManager>
  <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
  <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
    <telerik:RadGrid ID="RadGrid1" GridLines="Both" runat="server" AllowAutomaticDeletes="True" AllowSorting="True" AutoGenerateColumns="false"
                     AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowMultiRowEdit="False" 
                     AllowPaging="True" DataSourceID="DataSource1" OnItemUpdated="RadGrid1_ItemUpdated"
                     AllowFilteringByColumn="True" OnItemDeleted="RadGrid1_ItemDeleted" PageSize="25" 
                     OnItemInserted="RadGrid1_ItemInserted" OnDataBound="RadGrid1_DataBound">
      <PagerStyle Mode="NextPrevAndNumeric" Position="TopAndBottom" />
      <MasterTableView Width="100%" CommandItemDisplay="TopAndBottom" DataKeyNames="uid" 
                       DataSourceID="DataSource1" HorizontalAlign="NotSet" EditMode="InPlace">
        <Columns>
          <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
            <ItemStyle CssClass="MyImageButton" />
          </telerik:GridEditCommandColumn>
          <telerik:GridBoundColumn    DataField="uid" 
                                      HeaderText="uid" 
                                      SortExpression="uid" 
                                      UniqueName="uid" 
                                      ReadOnly="True">
          </telerik:GridBoundColumn>
          <telerik:GridDropDownColumn DataField="win7rationalizationstatusID" 
                                      DataSourceID="SqlDataSource3"   
                                      HeaderText="Rationalization Status"    
                                      ListTextField="Status"                                             
                                      ListValueField="uid"   
                                      UniqueName="win7rationalizationstatusID" 
                                      />  
          <telerik:GridDropDownColumn DataField="existingpkg" 
                                      DataSourceID="SqlDataSource2"   
                                      HeaderText="Existing Package"    
                                      ListTextField="PackageName"                                             
                                      ListValueField="uid"   
                                      UniqueName="PackageID" 
                                      />  
          <telerik:GridDropDownColumn DataField="win7preferredpackageid" 
                                      DataSourceID="SqlDataSource2"   
                                      HeaderText="Windown 7 Preferred Package"    
                                      ListTextField="PackageName"                                             
                                      ListValueField="uid"   
                                      UniqueName="WIn7PackageID" 
                                      />  
          <telerik:GridBoundColumn    DataField="mappeddate" 
                                      HeaderText="Date Mapped" 
                                      SortExpression="mappeddate" 
                                      UniqueName="mappeddate" 
                                      ReadOnly="True">
          </telerik:GridBoundColumn>
          <telerik:GridBoundColumn    DataField="mappedbyEmpID" 
                                      HeaderText="Mapped by" 
                                      SortExpression="mappedbyEmpID" 
                                      UniqueName="mappedbyEmpID" 
                                      ReadOnly="True">
          </telerik:GridBoundColumn>
        </Columns>
        <EditFormSettings>
          <FormTableItemStyle Wrap="False"></FormTableItemStyle>
          <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle>
          <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="3" BackColor="White" Width="100%" />
          <FormTableStyle CellSpacing="0" CellPadding="2" Height="110px" BackColor="White" />
          <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
          <EditColumn ButtonType="ImageButton" UniqueName="EditCommandColumn1" CancelText="Cancel edit">
          </EditColumn>
          <FormTableButtonRowStyle HorizontalAlign="Right" CssClass="EditFormButtonRow"></FormTableButtonRowStyle>
        </EditFormSettings>
      </MasterTableView>
    </telerik:RadGrid>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>
  </telerik:RadAjaxPanel>
  <asp:SqlDataSource 
    SelectCommand="SELECT pr.uid, pr.packageid as existingpkg, pk1.packagename, pr.win7rationalizationstatusID, rs.Status AS win7rationalizationstatus, pr.win7preferredpackageid, pk2.packagename as win7preferredpackagename, pr.notes, pr.mappeddate, pr.mappedbyEmpID FROM lc2.dbo.tbl_PackageRationalization pr join lc2.dbo.lu_tbl_packages as pk1 on pr.packageid = pk1.uid join lc2.dbo.lu_tbl_packages as pk2 on pr.win7preferredpackageid = pk2.uid join lc2.dbo.lu_tbl_win7apprationalizationstatus as rs on pr.win7rationalizationstatusID = rs.uid order by uid" 
    ConnectionString="<%$ ConnectionStrings:LC2ConnectionString %>" 
    ProviderName="System.Data.SqlClient" 
    ID="DataSource1" 
    runat="server" />
  <asp:SqlDataSource 
    SelectCommand="SELECT uid, PackageName as packagename FROM LC2.dbo.lu_tbl_Packages"
    ConnectionString="<%$ ConnectionStrings:LC2ConnectionString %>" 
    ProviderName="System.Data.SqlClient" 
    ID="SqlDataSource2" 
    runat="server" 
    />
  <asp:SqlDataSource 
    SelectCommand="SELECT uid, status FROM LC2.dbo.lu_tbl_Win7AppRationalizationStatus" 
    ConnectionString="<%$ ConnectionStrings:LC2ConnectionString %>" 
    ProviderName="System.Data.SqlClient" 
    ID="SqlDataSource3" 
    runat="server" 
    />

In "Edit Mode" this is what I see...

http://postimage.org/image/4dlvnyep1/ 

Which is all correct and working as expected
What I need to happen is this, turn the dropdowns into google suggest like combos
So end users can type the first characters of an package name and it shows the matches
This is exactly what I am trying to do ... http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/comboingrid/defaultvb.aspx?product=combobox

but the data for my dropdown would be coming from another table which is not like this example

How can I modify it so the combobox uses the lookup table instead of the main datasource?

1 Answer, 1 is accepted

Sort by
0
Accepted
Marin
Telerik team
answered on 23 Jul 2012, 02:35 PM
Hello,

 Indeed you can use the demo that you have found as a starting point. It does not  matter how you bind the control in this case. In order to enable the autocomplete feature you can simply set the MarkFirstMatch and AllowCustomText properties to true as shown in this demo.

All the best,
Marin
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
David OBrien
Top achievements
Rank 1
Answers by
Marin
Telerik team
Share this question
or