Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Create a drop-down selection View modes: 
User avatar
Member
Member
treehan77-gmail - 8/6/2012 3:45:10 PM
   
Create a drop-down selection
Can anyone walk me through how to put a drop-down onto a web page? I can't find any web part or docmentation for it. For starters, I just want to know how I can place the drop-down onto a page, then populate the drop-down with hard-coded values, such as 1,2,3,4,5. Later I will want to know how to populate it based SQL query results.

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 8/6/2012 5:31:36 PM
   
RE:Create a drop-down selection
You need to think bigger. What is your ultimate purpose for this dropdown? If you are going to use it in a form, then create a BizForm with a dropdown list field and add it to your page.

A dropdown list by itself doesn't really serve a purpose and it would be difficult to provide out of the box webparts of individual form controls and allow you to somehow use them together outside of the context of a BizForm or something similar, which is likely why Kentico doesn't provide them in that fashion.

If you just want a dropdown list that doesn't really do anything you can use any of the Listing web parts with any of the data source web parts and some transformations to render the markup of a select element with options.

Otherwise, you can always build your own custom web parts, which is as easy to do as building ascx controls for a regular .net project.

I hope this helps to answer your question

User avatar
Member
Member
treehan77-gmail - 8/7/2012 3:38:59 PM
   
RE:Create a drop-down selection
Thanks for helping. So i was successful in creating a transformation that rendered a drop-down. I just put the following in the transofrmation code:
<asp:DropDownList ID="dropManually" runat="Server">
<asp:ListItem Text="Option 1" Value="1" Selected="True"></asp:ListItem>
<asp:ListItem Text="Option 2" Value="2"></asp:ListItem>
<asp:ListItem Text="Option 3" Value="3"></asp:ListItem>
<asp:ListItem Text="Option 4" Value="4"></asp:ListItem>
</asp:DropDownList>

So how can i provide the data from SQLDataSource instead of hard-coding the values? ie Employer Name instead of "Option 1" etc.

User avatar
Member
Member
kentico_michal - 8/8/2012 1:34:57 AM
   
RE:Create a drop-down selection
Hi,

I think the following blog give you more information. In general, you need to let the drop down list know from which control it should take data. The drop down list control has the DataSourceID property in which you need to specify the ID of the data source: Link drop down list with datasource.

Best regards,
Michal Legen

User avatar
Member
Member
treehan77-gmail - 8/9/2012 12:50:28 PM
   
RE:Create a drop-down selection
How can I provide SQL query multiple values in parameter using DropDownList control?

I am using Kentico CMS and it lets you edit a web page layou in Visual Studio. I am using Microsoft Visual Web Developer 2010 Express to edit the .ascx file. This lets me drag and drop controls onto the layout, then Kentico lets me "check in" the changes. Forgive me, I have never used .ascx before, so please help!

I created a dropdownlist that needs to be populated by a SQL query:

SELECT DISTINCT [Consortium or Other] FROM [Sync_Employer_Information]
WHERE [Employer ID] IN (@IDs)
ORDER BY [Consortium or Other]

However, the parameter (@IDs) may consist of multiple values, which in turn are from a different SQL query that returns: ie 511, 512, 513... Upon selection of one of the [Consortium or Other] values, this then populates another dropdownlist. How do I get the query above to accept multiple values ofr the parameter? I set the parameter source of the first dropdownlist (SelectMRICGroup) to Control w/ ControlID: IDsListBox, so IDs = IDsListBox.SelectedValue. I don't want the listbox in the first place, it is just holding the returned values of the first query( SELECT [ClientID] FROM [tbl_BillingConsortium] WITH (NOLOCK)
WHERE [ConsortiumID]=16). This works for ONE selected value in the listbox fine. But how may I provide multiple values from the query (again, I don't want the listbox anyway, I just couldn't figure out how to provde even one value without placing it in a control)?

Here is the Source:

<%@ Control Language="C#" ClassName="Simple" Inherits="CMS.PortalControls.CMSAbstractLayout" %>
<%@ Register Assembly="CMS.PortalControls" Namespace="CMS.PortalControls" TagPrefix="cc1" %>
<%@ Register Assembly="CMS.Controls" Namespace="CMS.Controls" TagPrefix="cc1" %>
<cc1:CMSWebPartZone ID="zoneLeft" runat="server" />
<asp:SqlDataSource ID="IDsInMRIC" runat="server"
ConnectionString="<%$ ConnectionStrings:Report_DataConnectionString %>" SelectCommand="SELECT [ClientID] FROM [tbl_BillingConsortium] WITH (NOLOCK)
WHERE [ConsortiumID]=16"></asp:SqlDataSource>
<asp:ListBox ID="IDsListBox" runat="server" DataSourceID="IDsInMRIC" SelectionMode="Multiple"
DataTextField="ClientID" DataValueField="ClientID" AutoPostBack="True"
Width="202px"></asp:ListBox>
<asp:SqlDataSource ID="EmployerDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:TSADBConnectionString %>"
SelectCommand="SELECT [Client] FROM Sync_Employer_Information WITH (NOLOCK) WHERE ([Consortium or Other] IN (@ISD))">
<SelectParameters>
<asp:ControlParameter ControlID="SelectMRICGrp" Name="ISD"
PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="GetISD_DS" runat="server"
ConnectionString="<%$ ConnectionStrings:GetISDs %>" SelectCommand="SELECT DISTINCT [Consortium or Other] FROM [Sync_Employer_Information]
WHERE [Employer ID] IN (@IDs)
ORDER BY [Consortium or Other]">
<SelectParameters>
<asp:ControlParameter ControlID="IDsListBox" DefaultValue="" Name="IDs"
PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>
<asp:DropDownList ID="SelectMRICGrp" runat="server"
DataSourceID="GetISD_DS" DataTextField="Consortium or Other"
DataValueField="Consortium or Other" AutoPostBack="True">
</asp:DropDownList>
<asp:DropDownList ID="SelectEmployer" runat="server"
DataSourceID="EmployerDataSource" DataTextField="Client"
DataValueField="Client" AutoPostBack="True">
</asp:DropDownList>Is there a simple way to change the bolded SelectedValue PropertyName to something like "All values" or just provide the query that supplies those values directly? Since I am simply editing the .ascx file, is there no code-behind or what? Thanks!


User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 8/9/2012 1:02:59 PM
   
RE:Create a drop-down selection
Use a T- SQL Split function.

Add this function to your database:

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE FUNCTION [dbo].[Split]
(
@delimited nvarchar(max),
@delimiter nvarchar(100)
) RETURNS @t TABLE
(
val nvarchar(max)
)
AS
BEGIN
declare @xml xml
set @xml = N'<root><r>' + replace(@delimited,@delimiter,'</r><r>') + '</r></root>'

insert into @t(val)
select
r.value('.','varchar(5)') as item
from @xml.nodes('//root/r') as records(r)

RETURN
END
GO


then you can query like this :

SELECT DISTINCT [Consortium or Other] FROM [Sync_Employer_Information]
WHERE [Employer ID] IN (Select val from dbo.Split(@IDs,','))
ORDER BY [Consortium or Other]

User avatar
Member
Member
treehan77-gmail - 8/9/2012 1:05:26 PM
   
RE:Create a drop-down selection
ok thanks. will this still work if the database where [Employer Id] is coming from is on a different server?

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 8/9/2012 1:08:21 PM
   
RE:Create a drop-down selection
it will work as long as the query is running on the server that has the function, regardless of where the data is coming from.

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 8/9/2012 1:07:22 PM
   
RE:Create a drop-down selection
The next problem you are going to face is that your control parameter won't automatically send a delimited list of IDs to your SQL Datasource.

Read this article for solutions:http://forums.asp.net/t/946558.aspx/1

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 8/9/2012 1:50:08 PM
   
RE:Create a drop-down selection
This predicament gave me the idea to create a control to act as a middleman between your listbox control and your sql datasource. I haven't tried it at all yet, but it should work. Try it out. You can download it here:

http://www.mediafire.com/?jgb5gacythgdb18

Add that control to your project in the folder /Custom/UserControls/ And try this updated source code:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MultiSelectParameterControl.ascx.cs" Inherits="Custom_UserControls_MultiSelectParameterControl" %>
<%@ Control Language="C#" ClassName="Simple" Inherits="CMS.PortalControls.CMSAbstractLayout" %>
<%@ Register TagPrefix="custom" TagName="MultiSelectParameterControl" Src="~/Custom/UserControls/MultiSelectParameterControl.ascx" %>
<%@ Register Assembly="CMS.PortalControls" Namespace="CMS.PortalControls" TagPrefix="cc1" %>
<%@ Register Assembly="CMS.Controls" Namespace="CMS.Controls" TagPrefix="cc1" %>
<cc1:CMSWebPartZone ID="zoneLeft" runat="server" />
<asp:SqlDataSource ID="IDsInMRIC" runat="server" ConnectionString="<%$ ConnectionStrings:Report_DataConnectionString %>" SelectCommand="SELECT [ClientID] FROM [tbl_BillingConsortium] WITH (NOLOCK)
WHERE [ConsortiumID]=16"></asp:SqlDataSource>
<custom:MultiSelectParameterControl ID="IDsListBoxMulti" runat="server" AssociatedControlID="IDsListBox" Separator="," />
<asp:ListBox ID="IDsListBox" runat="server" DataSourceID="IDsInMRIC" SelectionMode="Multiple" DataTextField="ClientID" DataValueField="ClientID" AutoPostBack="True" Width="202px"></asp:ListBox>
<asp:SqlDataSource ID="EmployerDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:TSADBConnectionString %>" SelectCommand="SELECT [Client] FROM Sync_Employer_Information WITH (NOLOCK) WHERE ([Consortium or Other] IN (Select val from dbo.Splut(@ISD,',')))">
<SelectParameters>
<asp:ControlParameter ControlID="SelectMRICGrp" Name="ISD" PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="GetISD_DS" runat="server" ConnectionString="<%$ ConnectionStrings:GetISDs %>" SelectCommand="SELECT DISTINCT [Consortium or Other] FROM [Sync_Employer_Information]
WHERE [Employer ID] IN (@IDs)
ORDER BY [Consortium or Other]">
<SelectParameters>
<asp:ControlParameter ControlID="IDsListBoxMulti" DefaultValue="" Name="IDs" PropertyName="SelectedValues" />
</SelectParameters>
</asp:SqlDataSource>
<asp:DropDownList ID="SelectMRICGrp" runat="server" DataSourceID="GetISD_DS" DataTextField="Consortium or Other" DataValueField="Consortium or Other" AutoPostBack="True">
</asp:DropDownList>
<asp:DropDownList ID="SelectEmployer" runat="server" DataSourceID="EmployerDataSource" DataTextField="Client" DataValueField="Client" AutoPostBack="True">
</asp:DropDownList>



Let me know if it works.

User avatar
Member
Member
treehan77-gmail - 8/9/2012 4:07:48 PM
   
RE:Create a drop-down selection
wow thanks. but I don't have a /Custom/UserControls folder! C:\inetpub\wwwroot\KenticoCMS\Custom ? There is no UserControls folder here. Could you be a little more specific and I will try it out!

User avatar
Member
Member
treehan77-gmail - 8/9/2012 4:22:52 PM
   
RE:Create a drop-down selection
i tried just adding that folder myself and now visual studio isn't complaining and design view shows the new control, but the CMS Desk and Live site shows:

[Error loading the layout]
The file '/KenticoCMS/Custom/UserControls/MultiSelectParameterControl.ascx.cs' does not exist.

User avatar
Member
Member
treehan77-gmail - 8/9/2012 4:27:13 PM
   
RE:Create a drop-down selection
whoops visual studio is reporting the same in the source now that i look, that the CodeFile "MultiSelectParameterControl.ascx.cs" was not found

User avatar
Member
Member
treehan77-gmail - 8/9/2012 4:32:23 PM
   
RE:Create a drop-down selection
sorry looks like somehow the .cs file wasn't extracted. tried it again and get
Conversion failed when converting the nvarchar value '511,544' to data type int.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Conversion failed when converting the nvarchar value '511,544' to data type int.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[SqlException (0x80131904): Conversion failed when converting the nvarchar value '511,544' to data type int.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +212
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +245
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1099
System.Data.SqlClient.SqlDataReader.HasMoreRows() +266
System.Data.SqlClient.SqlDataReader.ReadInternal(Boolean setTimeout) +278
System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping) +198
System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) +295
System.Data.Common.DataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) +676
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +317
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +573
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +161
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +2790918
System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +71
System.Web.UI.WebControls.ListControl.PerformSelect() +49
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.ListControl.OnPreRender(EventArgs e) +31
System.Web.UI.Control.PreRenderRecursiveInternal() +108
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3394



User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 8/9/2012 4:56:31 PM
   
RE:Create a drop-down selection
ok, it looks like the control I sent you is doing it's job, that's pretty awesome.

It also looks like there is a problem with the query. I see where I put the dbo.Split in the wrong place. Here is some edited source code:


<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MultiSelectParameterControl.ascx.cs" Inherits="Custom_UserControls_MultiSelectParameterControl" %>
<%@ Control Language="C#" ClassName="Simple" Inherits="CMS.PortalControls.CMSAbstractLayout" %>
<%@ Register TagPrefix="custom" TagName="MultiSelectParameterControl" Src="~/Custom/UserControls/MultiSelectParameterControl.ascx" %>
<%@ Register Assembly="CMS.PortalControls" Namespace="CMS.PortalControls" TagPrefix="cc1" %>
<%@ Register Assembly="CMS.Controls" Namespace="CMS.Controls" TagPrefix="cc1" %>
<cc1:CMSWebPartZone ID="zoneLeft" runat="server" />
<asp:SqlDataSource ID="IDsInMRIC" runat="server" ConnectionString="<%$ ConnectionStrings:Report_DataConnectionString %>" SelectCommand="SELECT [ClientID] FROM [tbl_BillingConsortium] WITH (NOLOCK)
WHERE [ConsortiumID]=16"></asp:SqlDataSource>
<custom:MultiSelectParameterControl ID="IDsListBoxMulti" runat="server" AssociatedControlID="IDsListBox" Separator="," />
<asp:ListBox ID="IDsListBox" runat="server" DataSourceID="IDsInMRIC" SelectionMode="Multiple" DataTextField="ClientID" DataValueField="ClientID" AutoPostBack="True" Width="202px"></asp:ListBox>
<asp:SqlDataSource ID="EmployerDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:TSADBConnectionString %>" SelectCommand="SELECT [Client] FROM Sync_Employer_Information WITH (NOLOCK) WHERE ([Consortium or Other] IN (@ISD))">
<SelectParameters>
<asp:ControlParameter ControlID="SelectMRICGrp" Name="ISD" PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="GetISD_DS" runat="server" ConnectionString="<%$ ConnectionStrings:GetISDs %>" SelectCommand="SELECT DISTINCT [Consortium or Other] FROM [Sync_Employer_Information]
WHERE [Employer ID] IN (Select val from dbo.Split(@IDs,','))
ORDER BY [Consortium or Other]">
<SelectParameters>
<asp:ControlParameter ControlID="IDsListBoxMulti" DefaultValue="" Name="IDs" PropertyName="SelectedValues" />
</SelectParameters>
</asp:SqlDataSource>
<asp:DropDownList ID="SelectMRICGrp" runat="server" DataSourceID="GetISD_DS" DataTextField="Consortium or Other" DataValueField="Consortium or Other" AutoPostBack="True">
</asp:DropDownList>
<asp:DropDownList ID="SelectEmployer" runat="server" DataSourceID="EmployerDataSource" DataTextField="Client" DataValueField="Client" AutoPostBack="True">
</asp:DropDownList>


User avatar
Member
Member
treehan77-gmail - 8/10/2012 7:54:46 AM
   
RE:Create a drop-down selection
thanks for the continued help! i am getting a servor error still, I assume it's because i have not added the function to the sql database though. for this project, I'm not allowed to edit the sql db at all. is there any way i can get around adding the split func?

Server Error in '/KenticoCMS' Application.
--------------------------------------------------------------------------------

Invalid object name 'dbo.Split'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'dbo.Split'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[SqlException (0x80131904): Invalid object name 'dbo.Split'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +212
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +245
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1099
System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +58
System.Data.SqlClient.SqlDataReader.get_MetaData() +112
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +6291924
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +6292993
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +424
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +28
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +211
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +19
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +19
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +221
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +573
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +161
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +2790918
System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +71
System.Web.UI.WebControls.ListControl.PerformSelect() +49
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.ListControl.OnPreRender(EventArgs e) +31
System.Web.UI.Control.PreRenderRecursiveInternal() +108
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3394




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.5456; ASP.NET Version:2.0.50727.5456

User avatar
Member
Member
treehan77-gmail - 8/10/2012 7:57:47 AM
   
RE:Create a drop-down selection
...and how can i do this without the use of the listbox at all? my ultimate goal is to populate the first dropdownlist without seeing / selecting anything in that listbox, i want to provide ALL values to this parameter to start with, not just what the user selects.

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 8/10/2012 1:11:10 PM
   
RE:Create a drop-down selection
This still depends on you being able to add that function to the Kentico Database.

You can check the Length of the @IDs parameter and query all of them if it is = 0. Like this query:


SELECT DISTINCT [Consortium or Other] FROM [Sync_Employer_Information]
WHERE
((LEN(@IDs) = 0 AND and EmployerID in (SELECT [ClientID] FROM [tbl_BillingConsortium] WITH (NOLOCK)
WHERE [ConsortiumID]=16)
OR
(LEN(@IDs >0) AND
[Employer ID]
IN (Select val from dbo.Split(@IDs,','))))
ORDER BY [Consortium or Other]

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 8/10/2012 1:04:37 PM
   
RE:Create a drop-down selection
You definitely need to add that split function to the database for that to work. It's also going to be the easiest way to make this work without requiring you to do some real coding. Without that split function, you are going to have to programmatically modify the select statement of that SQLDataSource control, which means you will have to use an event handler and you'll have to build the query to actually have a comma delimited list of IDs instead of passing a parameter to it.

Do your best to get permission to add that function. It will save you lots and lots of time and effort.

User avatar
Member
Member
treehan77-gmail - 8/10/2012 1:19:10 PM
   
RE:Create a drop-down selection
I just ended up copying the db's to the box Kentico is installed on for now. The split function worked, everything worked as i wanted it to. However, since i copied the db's, I ended up redoing everything anyway since now i can actually do a JOIN between the db's that used to be on different servers. That made it really easy, I could eliminate the whole list box altogether. Your solution did work though for the original problem, thanks a lot! I'm pleased to see the forums are manned well, we will most likely be purchasing Kentico soon (I'm working on trial version now for evaluation purposes).

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 8/10/2012 1:23:01 PM
   
RE:Create a drop-down selection
I think you'll be very happy with Kentico. I absolutely love working with it. It makes it so easy to develop the most common features that clients request and gives the client a very user friendly interface that I don't have to spend hours to develop, all at the same time!

P.S. I don't work for Kentico, I just like to help people.

User avatar
Member
Member
treehan77-gmail - 8/10/2012 1:48:49 PM
   
RE:Create a drop-down selection
Well thanks again for all your help. I don't see any thumbs up icon or anything, or I'd click it for you. Did you ever attend the Kentico training seminars? I believe it's 5 days online. Trying to see if it is worth it. Obviously Kentico is very in depth and it may show me a lot.

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 8/10/2012 3:13:10 PM
   
RE:Create a drop-down selection
I haven't done any training seminars. I learn best by studying the code and trying things out. I'm sure they are worth it though.