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

RADCombobox Multiple Parameters

5 Answers 318 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Prithvi
Top achievements
Rank 1
Prithvi asked on 17 Jan 2011, 03:11 PM
Hi,

I am using autocomplete for a RADCombobox. 

[OperationContract]
public RadComboBoxData wpfSelectProgrammeFromClientDB(RadComboBoxContext context)
{
}

In this service, I am using a SQL Query to fill a datatable.

strSQLQuery = "SELECT pk_ProgrammeID,Title FROM Programme WHERE Title LIKE @prefixText";
da = new SqlDataAdapter(strSQLQuery, ConfigurationManager.ConnectionStrings["DEMO"].ToString());
da.SelectCommand.Parameters.Add("@prefixText", SqlDbType.VarChar, 50).Value = "%" + context.Text + "%";
dt = new DataTable();
da.Fill(dt);

In my .aspx, I use

<telerik:RadComboBox ID="rcbClientProgrammeTitle" Runat="server" EmptyMessage="Select a Title" EnableLoadOnDemand="true" 
                                ShowMoreResultsBox="true" EnableVirtualScrolling="true" Skin="Windows7" 
                                AutoPostBack="True" >
<WebServiceSettings Method="SelectProgrammeFromClientDB" Path="LinkMedia.aspx.cs"/>
</telerik:RadComboBox>

I need to pass a second parameter to the SQL Query, like

strSQLQuery = "SELECT pk_ProgrammeID,Title FROM Programme WHERE Title LIKE @prefixText AND Client = @Client";
da = new SqlDataAdapter(strSQLQuery, ConfigurationManager.ConnectionStrings["DEMO"].ToString());
da.SelectCommand.Parameters.Add("@prefixText", SqlDbType.VarChar, 50).Value = "%" + context.Text + "%";
da.SelectCommand.Parameters.Add("@Client", SqlDbType.VarChar, 50).Value = " + WHAT DO I PASS HERE;
dt = new DataTable();
da.Fill(dt);

OR is there any other alternative to do this. The @Client comes from a Query String which I am not able to access in the WCF Service.

Can you please show me a demo of how to send multiple parameters to the Service or how to access the query string values from the page in the service.

Thanks
Prithvi

5 Answers, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 17 Jan 2011, 03:42 PM
Hi Prithvi,

Please check this help article  - it demonstrates how to pass additional information to the web service.

All the best,
Yana
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Prithvi
Top achievements
Rank 1
answered on 17 Jan 2011, 04:58 PM
Hi Yana,

Thanks for the reply. The example that you specified uses the code

context["FilterString"] = eventArgs.get_text();

How do I get this in my web service with RadComboBoxContext context

public RadComboBoxData wpfSelectProgrammeFromClientDB(RadComboBoxContext context)
{
}

I tried the following

<telerik:RadTextBox ID="rtbClientID" runat="server" Visible="false"></telerik:RadTextBox>

function OnClientItemsRequesting(sender, eventArgs) {
var lblClientID = $find("<%# rtbClientID.ClientID %>");
var clientIDText = lblClientID.get_text();
var context = eventArgs.get_context();
context["ClientID"] = clientIDText;
}

<telerik:RadComboBox ID="rcbClientProgrammeTitle" Runat="server" 
                    EmptyMessage="Select a Title" EnableLoadOnDemand="true" 
                                ShowMoreResultsBox="true" EnableVirtualScrolling="true" Skin="Windows7" 
                                OnClientItemsRequesting="OnClientItemsRequesting" >
                            <WebServiceSettings Method="wpfSelectProgrammeFromClientDB" Path="Services/AutoCompleteWebControl.svc"/>
</telerik:RadComboBox>


But the web service and autocomplete don't fire up for the combobox. Is there anything else I am missing.

Thanks
Prithvi
0
Prithvi
Top achievements
Rank 1
answered on 17 Jan 2011, 07:11 PM
Thanks. I figured it out. I used

context["ClientID"] = <%= Request.QueryString["ClientID"] %>

to set the QueryString value to the context in the OnClientItemsRequesting() function.

Thanks
Prithvi
0
Jeff
Top achievements
Rank 1
answered on 02 Oct 2012, 07:17 PM
When you reference an article, the article should actually exist...
0
Kalina
Telerik team
answered on 03 Oct 2012, 08:33 AM
Hi Jeff,

Please excuse us for the inconvenience caused.
The link below has been posted in January 2011 - more than an year ago.
During this time we have made some changes in our online help and some of the links have been changed.

We have fixed the link and you can use it now.
Thank you for pointing our attention to this.

Regards,
Kalina
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
ComboBox
Asked by
Prithvi
Top achievements
Rank 1
Answers by
Yana
Telerik team
Prithvi
Top achievements
Rank 1
Jeff
Top achievements
Rank 1
Kalina
Telerik team
Share this question
or