or
I need help. I don’t know if I'm on the right track or if there is a better way to select a value from a foreign table.
I have 77.000 records in my foreign table and it creates loading problem when I open my EditForm.
I use an ObjectDataSource
| <asp:ObjectDataSource ID="DS_All" runat="server" SelectMethod="getAll" |
| TypeName="CRSUsing+CRSData" > |
| </asp:ObjectDataSource> |
The code behind looks like this
| public class loopUpData |
| { |
| string Id; |
| string Txt; |
| public String id |
| { |
| get { return Id; } |
| set { Id = value; } |
| } |
| public String txt |
| { |
| get { return Txt; } |
| set { Txt = value; } |
| } |
| } |
| public ICollection getSagsbudgetAll() |
| { |
| SqlConnection myConnection; |
| ArrayList LookUplist = new ArrayList(); |
| myConnection = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["SubjectConnect"].ToString()); |
| SqlCommand myCommand = new SqlCommand( |
| @"SELECT distinct CAST(ID AS VARCHAR) as Id, |
| (CAST(Id AS VARCHAR) + ' ' + Name) as Txt |
| FROM s_dim |
| ORDER BY Id", myConnection); |
| myConnection.Open(); |
| SqlDataReader reader = myCommand.ExecuteReader(); |
| while (reader.Read()) |
| { |
| loopUpData lookUp = new loopUpData(); |
| lookUp.id = (string)reader["Id"]; |
| lookUp.txt = (string)reader["Txt"]; |
| LookUplist.Add(lookUp); |
| } |
| myConnection.Close(); |
| reader.Close(); |
| myCommand.Dispose(); |
| if (LookUplist != null && LookUplist.Count > 0) |
| return LookUplist; |
| else return null; |
| } |
| <telerik:RadComboBox ID="Box1" AppendDataBoundItems="true" runat="server" DataSourceID="DS_All" |
| Width="300px" DataTextField="Txt" DataValueField="Id" AutoPostBack="True" |
| EnableVirtualScrolling="true" TabIndex="1" EnableLoadOnDemand="true" |
| ShowMoreResultsBox="true" |
| SelectedValue='<%# DataBinder.Eval(Container, "DataItem.Value") %>' |
| ReadOnly='<%# DataItem is GridInsertionObject %>' Skin="Office2007" > |
| </telerik:RadComboBox> |
Any Ideas on how to do this?
Thanks
Erik
| <telerik:GridCheckBoxColumn DataField="IsOptimumStaff" |
| HeaderText="Active" CurrentFilterFunction="EqualTo" |
| CurrentFilterValue="false" Visible="false" /> |
| <telerik:GridBoundColumn DataField="Region.RegionId" |
| HeaderText="Region Id" Visible="false" |
| CurrentFilterFunction="EqualTo" |
| CurrentFilterValue='<%= Session("CurrentRegion") %>' /> |
| <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
| <%@ Register assembly="System.Web.Ajax" namespace="System.Web.UI" tagprefix="asp" %> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head id="Head1" runat="server"> |
| <title>Untitled Page</title> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <div> |
| <AppointmentTemplate> |
| <div class="rsCustomAppointmentContainer <%# Eval("AppointmentType.Text") %>"> |
| <h2><%# Eval("Subject") %> |
| <asp:AjaxScriptManager ID="AjaxScriptManager1" runat="server"> |
| </asp:AjaxScriptManager> |
| </h2> |
| </div> |
| </AppointmentTemplate> |
| <telerik:RadScheduler ID="RadScheduler1" runat="server" |
| CustomAttributeNames="fileUpload" DataDescriptionField="jobDescription" |
| DataEndField="jobEnd" DataKeyField="jobId" DataSourceID="SqlDataSource1" |
| DataStartField="jobLive" DataSubjectField="jobName" Skin="Windows7"> |
| <ResourceStyles> |
| <telerik:ResourceStyleMapping ApplyCssClass="" Key="fileUpload" Text="" |
| Type="url" /> |
| </ResourceStyles> |
| </telerik:RadScheduler> |
| <asp:SqlDataSource ID="SqlDataSource1" runat="server" |
| ConnectionString="<%$ ConnectionStrings:JT2010ConnectionString %>" |
| SelectCommand="SELECT [jobId], [jobName], [jobType], [jobLive], [jobEnd], [jobDescription], [fileUpload], [UserId], [jobStatus], [jobCreated] FROM [Jobs] WHERE ([jobStatus] = @jobStatus)"> |
| <SelectParameters> |
| <asp:Parameter DefaultValue="New" Name="jobStatus" Type="String" /> |
| </SelectParameters> |
| </asp:SqlDataSource> |
| <InlineInsertTemplate> |
| <div id="InlineInsertTemplate" class="rsCustomAppointmentContainer <%# Eval("AppointmentType.Text") %>"> |
| <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Subject") %>' Width="90%" TextMode="MultiLine" Height="20px"></asp:TextBox> |
| <asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert"> |
| <asp:Image runat="server" ID="insertImage" ImageUrl="Images/ok.gif" AlternateText="insert" /> |
| </asp:LinkButton> |
| <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"> |
| <asp:Image runat="server" ID="Image2" ImageUrl="Images/cancel.gif" AlternateText="cancel" /> |
| </asp:LinkButton> |
| <div class="inline-label">Color code:</div> |
| <asp:RadioButtonList runat="server" ID="AppointmentTypeRadioButtonList" |
| DataValueField="type" CssClass="AppointmentTypeSelectorTable" |
| DataSourceID="SqlDataSource2" SelectedValue='<%# Bind("AppointmentTypeID") %>' DataTextField="type" |
| RepeatDirection="Horizontal" |
| DataTextFormatString="<span class='AppointmentTypeSelector rsAptType_{0}' onclick='onAppointmentTypeSelectorClick'></span>"> |
| </asp:RadioButtonList> |
| <asp:SqlDataSource ID="SqlDataSource2" runat="server" |
| ConnectionString="<%$ ConnectionStrings:JT2010ConnectionString %>" |
| SelectCommand="SELECT [id], [type] FROM [JobType]"></asp:SqlDataSource> |
| <asp:LinkButton ID="InsertMoreButton" runat="server" CommandName="More" CssClass="rsAdvancedEditLink">Advanced</asp:LinkButton> |
| </div> |
| </InlineInsertTemplate> |
| <InlineEditTemplate> |
| <div id="InlineEditTemplate" class="rsCustomAppointmentContainer <%# Eval("AppointmentType.Text") %>"> |
| <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Subject") %>' Width="90%" TextMode="MultiLine" Height="20px"></asp:TextBox> |
| <asp:LinkButton ID="LinkButton3" runat="server" CommandName="Update"> |
| <asp:Image runat="server" ID="Image6" ImageUrl="Images/ok.gif" AlternateText="update" /> |
| </asp:LinkButton> |
| <asp:LinkButton ID="LinkButton4" runat="server" CausesValidation="False" CommandName="Cancel"> |
| <asp:Image runat="server" ID="Image7" ImageUrl="Images/cancel.gif" AlternateText="cancel" /> |
| </asp:LinkButton> |
| <div class="inline-label">Color code:</div> |
| <asp:RadioButtonList runat="server" ID="RadioButtonList3" DataValueField="type" CssClass="AppointmentTypeSelectorTable" |
| DataSourceID="SqlDataSource2" SelectedValue='<%# Bind("AppointmentTypeID") %>' DataTextField="type" |
| RepeatDirection="Horizontal" |
| DataTextFormatString="<span class='AppointmentTypeSelector rsAptType_{0}' onclick='onAppointmentTypeSelectorClick'></span>"> |
| </asp:RadioButtonList> |
| <asp:LinkButton ID="LinkButton5" runat="server" CommandName="More" CssClass="rsAdvancedEditLink">Advanced</asp:LinkButton> |
| </div> |
| </InlineEditTemplate> |
| </div> |
| </form> |
| </body> |
| </html> |
| Imports System.Web |
| Imports System.Web.UI.HtmlControls |
| Imports System.Web.UI.WebControls |
| Imports System.Web.ApplicationServices |
| Partial Class users_Default4 |
| Inherits System.Web.UI.Page |
| Protected Sub RadScheduler1_FormCreated(ByVal sender As Object, _ |
| ByVal e As SchedulerFormCreatedEventArgs) |
| If e.Container.Mode = SchedulerFormMode.Insert Then |
| Dim list As RadioButtonList = _ |
| DirectCast(e.Container.FindControl("AppointmentTypeRadioButtonList"), _ |
| RadioButtonList) |
| list.SelectedIndex = 0 |
| End If |
| End Sub |
| End Class |