Hi all I have a Radgrid in my form . where i have a editform template . I have textbox control on it. I want to apply autocomplete on this textbox. But this is not working. i have tested it with another textbox outside the grid it is working. i am using Ajax and webservice for this.
i am taking class name for autocomplete operation in ajax. Please help.
i am attaching my code
$(function() {
var x = document.getElementById("hid1").value;
// alert(x);
$(".aaa").autocomplete({
source: function(request, response) {
$.ajax({
url: "EmployeeList.asmx/FetchEmailList",
data: "{ 'mail123': '" + request.term + "' }",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
dataFilter: function(data) { return data; },
success: function(data) {
response($.map(data.d, function(item) {
return {
value: item.MenuName
}
}))
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
}
});
},
minLength: 1
});
});
and the grid is
<telerik:RadGrid ID="RadGridNewApi" runat="server" GridLines="None"
Skin="WebBlue" AllowPaging="false" AllowSorting="True" AutoGenerateColumns="False"
OnNeedDataSource="RadGridNewApi_NeedDataSource" ShowStatusBar="true" AllowAutomaticDeletes="True"
AllowAutomaticInserts="True" AllowAutomaticUpdates="True" OnItemCreated="ItemCreated">
<MasterTableView CommandItemDisplay="Top" DataKeyNames="">
<CommandItemSettings AddNewRecordText="Add Field" RefreshText=""></CommandItemSettings>
<Columns>
<telerik:GridBoundColumn UniqueName="MenuName" HeaderText="MenuName" DataField="MenuName">
<HeaderStyle Width="60px"></HeaderStyle>
</telerik:GridBoundColumn>
</Columns>
<EditFormSettings EditFormType="Template">
<FormTemplate>
<table id="Table9" cellspacing="5" cellpadding="5" width="97%" border="0" rules="none"
style="background: white;">
<tr>
<td>
<table id="Table7" cellspacing="5" cellpadding="5" width="100%" border="0" class="module">
<tr>
<td>
Mask Name:
</td>
<td>
<asp:TextBox runat="server" ID="txtMaskName" class="aaa" Text='<%# Bind("MenuName")%>' ></asp:TextBox>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Add" : "Update" %>'
runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
</asp:Button>
<asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
CommandName="Cancel"></asp:Button>
</td>
</tr>
</table>
</FormTemplate>
</EditFormSettings>
</MasterTableView>
</telerik:RadGrid>
i am taking class name for autocomplete operation in ajax. Please help.
i am attaching my code
$(function() {
var x = document.getElementById("hid1").value;
// alert(x);
$(".aaa").autocomplete({
source: function(request, response) {
$.ajax({
url: "EmployeeList.asmx/FetchEmailList",
data: "{ 'mail123': '" + request.term + "' }",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
dataFilter: function(data) { return data; },
success: function(data) {
response($.map(data.d, function(item) {
return {
value: item.MenuName
}
}))
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
}
});
},
minLength: 1
});
});
and the grid is
<telerik:RadGrid ID="RadGridNewApi" runat="server" GridLines="None"
Skin="WebBlue" AllowPaging="false" AllowSorting="True" AutoGenerateColumns="False"
OnNeedDataSource="RadGridNewApi_NeedDataSource" ShowStatusBar="true" AllowAutomaticDeletes="True"
AllowAutomaticInserts="True" AllowAutomaticUpdates="True" OnItemCreated="ItemCreated">
<MasterTableView CommandItemDisplay="Top" DataKeyNames="">
<CommandItemSettings AddNewRecordText="Add Field" RefreshText=""></CommandItemSettings>
<Columns>
<telerik:GridBoundColumn UniqueName="MenuName" HeaderText="MenuName" DataField="MenuName">
<HeaderStyle Width="60px"></HeaderStyle>
</telerik:GridBoundColumn>
</Columns>
<EditFormSettings EditFormType="Template">
<FormTemplate>
<table id="Table9" cellspacing="5" cellpadding="5" width="97%" border="0" rules="none"
style="background: white;">
<tr>
<td>
<table id="Table7" cellspacing="5" cellpadding="5" width="100%" border="0" class="module">
<tr>
<td>
Mask Name:
</td>
<td>
<asp:TextBox runat="server" ID="txtMaskName" class="aaa" Text='<%# Bind("MenuName")%>' ></asp:TextBox>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Add" : "Update" %>'
runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
</asp:Button>
<asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
CommandName="Cancel"></asp:Button>
</td>
</tr>
</table>
</FormTemplate>
</EditFormSettings>
</MasterTableView>
</telerik:RadGrid>