Hi,
I am binding AutoCompleteBox with my DB. In my table there are names like( xyz's company,robin's house etc.).
When i type x it shows me the name list but when i select the xyz's company i just got error because of single quotes.
Please help!!!!!!!!
Thanks in Advance.
I am binding AutoCompleteBox with my DB. In my table there are names like( xyz's company,robin's house etc.).
When i type x it shows me the name list but when i select the xyz's company i just got error because of single quotes.
Please help!!!!!!!!
Thanks in Advance.
9 Answers, 1 is accepted
0
Accepted
Hi divyalok suman,
The issue that you describe is quite strange.
I tried to reproduce it with RadAutoCompleteBox populated with data from the Northwind database (the Products table) - but without success - please take a look at this demonstration video.
Please download the sample that I have attached here and give it a try.
All the best,
Kalina
the Telerik team
The issue that you describe is quite strange.
I tried to reproduce it with RadAutoCompleteBox populated with data from the Northwind database (the Products table) - but without success - please take a look at this demonstration video.
Please download the sample that I have attached here and give it a try.
All the best,
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.
0
divyalok
Top achievements
Rank 1
answered on 21 Aug 2012, 06:08 AM
Hi Kalina,
Thanks for your quick response.
The problem again occurs when i add OnEntryAdded="SetValue" this event. and try to call the server side method to set text value(s).
Is there any other way that i can set the text value(s) to server side variable? Actually i was trying to fill other autocompletebox depending on the text in first one.
Like One organisation have 2 employee and other organisation have 4 employee. so if both selected in 1st drop down then all the 6 contact should display.
Thanks alot!!!!!!
Regards,
DLS
Thanks for your quick response.
The problem again occurs when i add OnEntryAdded="SetValue" this event. and try to call the server side method to set text value(s).
Is there any other way that i can set the text value(s) to server side variable? Actually i was trying to fill other autocompletebox depending on the text in first one.
Like One organisation have 2 employee and other organisation have 4 employee. so if both selected in 1st drop down then all the 6 contact should display.
Thanks alot!!!!!!
Regards,
DLS
0
Hello divyalok suman,
I am not sure that I understand what you mean by "call the server side method to set text value(s)".
Maybe you want to add an initially selected entry(entries) in the second RadAutoCompleteBox?
You can make this by simply adding these entries in the control Entries collection:
Regards,
Kalina
the Telerik team
I am not sure that I understand what you mean by "call the server side method to set text value(s)".
Maybe you want to add an initially selected entry(entries) in the second RadAutoCompleteBox?
You can make this by simply adding these entries in the control Entries collection:
<
telerik:RadAutoCompleteBox
runat
=
"server"
ID
=
"RadAutoComplete1"
Width
=
"300"
DropDownWidth
=
"300"
DataSourceID
=
"SqlDataSource1"
DataTextField
=
"CategoryName"
DataValueField
=
"CategoryID"
>
</
telerik:RadAutoCompleteBox
>
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"SqlDataSource1"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString1 %>"
SelectCommand="SELECT [CategoryID], [CategoryName], [Description] FROM [Categories]">
</
asp:SqlDataSource
>
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!IsPostBack)
this
.RadAutoComplete1.Entries.Add(
new
Telerik.Web.UI.AutoCompleteBoxEntry(
"Condiments"
,
"2"
));
}
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.
0
divyalok
Top achievements
Rank 1
answered on 21 Aug 2012, 12:04 PM
Hi Kalina,
Actually my scenario is there are two controls i.e. RadAutoCompleteBox1 and RadAutoCompleteBox2. I load the company name in first control and i want all the employee related to that company in second control i.e. ( when i try to write name it should display the related employee name).
so for that when i added the server side event OnEntryAdded="SetValue" and when i select any text like "xyz's company" then it give me an error.
So, plz suggest how can i achieve this goal.
Thanks in advance..
Regards,
DLS
Actually my scenario is there are two controls i.e. RadAutoCompleteBox1 and RadAutoCompleteBox2. I load the company name in first control and i want all the employee related to that company in second control i.e. ( when i try to write name it should display the related employee name).
so for that when i added the server side event OnEntryAdded="SetValue" and when i select any text like "xyz's company" then it give me an error.
So, plz suggest how can i achieve this goal.
Thanks in advance..
Regards,
DLS
0
divyalok
Top achievements
Rank 1
answered on 22 Aug 2012, 04:58 AM
Hi ,
Please help!!!!!!!!!.
Thanks in ADV.
DLS
Please help!!!!!!!!!.
Thanks in ADV.
DLS
0
Hi divyalok suman,
The sample code provided below only illustrated the approach that you can use.
As I understand – your scenario is more specific.
Please provide us more details about your implementation and paste here some working code to illustrate it.
Thank you in advance.
Regards,
Kalina
the Telerik team
The sample code provided below only illustrated the approach that you can use.
As I understand – your scenario is more specific.
Please provide us more details about your implementation and paste here some working code to illustrate it.
Thank you in advance.
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.
0
divyalok
Top achievements
Rank 1
answered on 23 Aug 2012, 04:33 PM
Hi Kalina,
Thanks for your reply.
I have pasted the sample code below. Please have look. Just select any value having apostrophe sign and then you will see error.
Code for ASPX page
<div>
<asp:ScriptManager ID="Manager" runat="server">
</asp:ScriptManager>
<telerik:RadAutoCompleteBox runat="server" ID="RadAutoCompleteBox1" Width="300" DataSourceID="SqlDataSource1"
DataTextField="LastName" DataValueField="EmployeeID" OnEntryAdded="RadAutoCompleteBox1_EntryAdded">
</telerik:RadAutoCompleteBox>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM [Employees]"></asp:SqlDataSource>
<br />
<asp:Label ID="Label1" runat="server" />
</div>
For Code Behind
protected void RadAutoCompleteBox1_EntryAdded(object sender, AutoCompleteEntryEventArgs e)
{
Label1.Text = e.Entry.Text + " was added.";
}
Please suggest solution.
Thanks in advance.
Regards,
Divyalok Suman.
Thanks for your reply.
I have pasted the sample code below. Please have look. Just select any value having apostrophe sign and then you will see error.
Code for ASPX page
<div>
<asp:ScriptManager ID="Manager" runat="server">
</asp:ScriptManager>
<telerik:RadAutoCompleteBox runat="server" ID="RadAutoCompleteBox1" Width="300" DataSourceID="SqlDataSource1"
DataTextField="LastName" DataValueField="EmployeeID" OnEntryAdded="RadAutoCompleteBox1_EntryAdded">
</telerik:RadAutoCompleteBox>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM [Employees]"></asp:SqlDataSource>
<br />
<asp:Label ID="Label1" runat="server" />
</div>
For Code Behind
protected void RadAutoCompleteBox1_EntryAdded(object sender, AutoCompleteEntryEventArgs e)
{
Label1.Text = e.Entry.Text + " was added.";
}
Please suggest solution.
Thanks in advance.
Regards,
Divyalok Suman.
0
divyalok
Top achievements
Rank 1
answered on 27 Aug 2012, 10:52 AM
Hi,
Please suggest the solution for this problem.
Thanks in advance..
DLS
Please suggest the solution for this problem.
Thanks in advance..
DLS
0
Accepted
Hello divyalok suman,
I managed to reproduce the issue.
Let me suggest you handle the OnClientEntryAdding event in this way:
All the best,
Kalina
the Telerik team
I managed to reproduce the issue.
Let me suggest you handle the OnClientEntryAdding event in this way:
<head runat=
"server"
>
<title></title>
<script type=
"text/javascript"
>
function
OnClientEntryAdding(sender, eventArgs) {
var
text = eventArgs.get_entry().get_text().replace(
"'"
,
"'"
);
eventArgs.get_entry().set_text(text);
}
</script>
</head>
<body>
<form id=
"form1"
runat=
"server"
>
<div>
<asp:ScriptManager ID=
"ScriptManager1"
runat=
"server"
></asp:ScriptManager>
<telerik:RadAutoCompleteBox runat=
"server"
ID=
"RadAutoCompleteBox1"
Width=
"300"
DataSourceID=
"SqlDataSource1"
OnClientEntryAdding=
"OnClientEntryAdding"
DataTextField=
"LastName"
DataValueField=
"EmployeeID"
OnEntryAdded=
"RadAutoCompleteBox1_EntryAdded"
>
</telerik:RadAutoCompleteBox>
</div>
<asp:Label ID=
"Label1"
runat=
"server"
/>
<asp:SqlDataSource ID=
"SqlDataSource1"
runat=
"server"
ConnectionString=
"<%$ ConnectionStrings:NorthwindConnectionString1 %>"
ProviderName=
"<%$ ConnectionStrings:NorthwindConnectionString1.ProviderName %>"
SelectCommand=
"SELECT * FROM [Employees]"
>
</asp:SqlDataSource>
</form>
</body>
All the best,
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.