- Home
- Forum
- ASP.NET MVC - EJ 2
- How to disable autocomplete in texbox when editing a row in a Grid
How to disable autocomplete in texbox when editing a row in a Grid
Hi!
I'm searching a way to put autocomplete as false for the textbox when editing a row in a Grid. Any idea how to do this?

Thanks, regards!
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
AG
Ajith Govarthan
Syncfusion Team
December 14, 2020 12:36 PM UTC
Hi Daniel,
Thanks for contacting Syncfusion support.
Query: I'm searching a way to put autocomplete as false for the textbox when editing a row in a Grid. Any idea how to do this?
Based on your query you want to set autocomplete as false for the textbox when editing and adding a row. So, we have prepared sample and in that sample we have turned-off the autocomplete in the input elements by setting the autocomplete as off using the actionComplete event.
For your convenience we have attached the sample and the general forum link so please refer the sample for your reference.
Code Example:
|
Index.cshtml
<div class="control-section">
@Html.EJS().Grid("DefaultPaging").DataSource(ds => ds.Url("/Home/UrlDatasource").Adaptor("UrlAdaptor").InsertUrl("/Home/Insert").RemoveUrl("/Home/Remove").UpdateUrl("/Home/Update")).Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").ValidationRules(new { required = "true" }).Width("120").IsPrimaryKey(true).Filter(new { type = "CheckBox" }).TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
col.Field("CustomerID").HeaderText("Customer Name").Width("170").Add();
col.Field("Id").HeaderText("Customer Name").Edit(new { @params = new { popupWidth = "300px" } }).DataSource((IEnumerable<object>)ViewBag.Species).ForeignKeyField("Id").ForeignKeyValue("name").Width("170").Add();
col.Field("OrderDate").HeaderText("Order Date").Width("130").EditType("datepickeredit").Format("yMd").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
col.Field("Freight").HeaderText("Freight").Width("120").Format("C2").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
col.Field("ShipCountry").EditType("dropdownedit").HeaderText("Ship Country").Width("150").Add();
}).Height("400").ActionComplete("actionComplete").AllowPaging().Toolbar(new List<string>
() { "Add", "Edit", "Delete", "Update", "Cancel" }).AllowFiltering().FilterSettings(filter => filter.Type(Syncfusion.EJ2.Grids.FilterType.Menu)).EditSettings(edit => { edit.AllowEditing(true).AllowAdding(true).AllowDeleting(true); }).Render()
</div>
<script>
function actionComplete(args) {
if (args.requestType === "add" || args.requestType === "beginEdit") {
// here we are setting the autocomplete as for edit form
args.form.autocomplete = "off";
}
}
</script> |
Sample Link : https://www.syncfusion.com/downloads/support/directtrac/general/ze/foreignkey-1103608299-mvc_-_text_autocomplete764574187.zip
Reference Link: https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
Note: If you still having the autoComplete in the input elements, we suggest to disable the autoComplete option in the browser level.
Please let us know, if you need further assistance.
Regards,
Ajith G.
Marked as answer
DA
Daniel
December 14, 2020 09:58 PM UTC
Thanks, works fine with the example.
Regards!
AG
Ajith Govarthan
Syncfusion Team
December 15, 2020 12:12 PM UTC
Hi Daniel,
Thanks for update.
We are happy to hear that your issue has been resolved.
Please get back to us if you need further assistance.
Regards,
Ajith G.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
- Marked answer
-
DA Daniel
- Dec 13, 2020 12:56 AM UTC
- Dec 15, 2020 12:12 PM UTC