---
title: "Knockout.js with Asp.Net MVC?"  
description: "Knockout.js with Asp.Net MVC?"  
author: "Anonymous User"  
published: 2014-10-08  
updated: 2014-10-08  
canonical: https://www.mindstick.com/forum/2330/knockout-js-with-asp-dot-net-mvc  
category: "asp.net mvc"  
tags: ["asp.net", "asp.net mvc"]  
reading_time: 1 minute  

---

# Knockout.js with Asp.Net MVC?

Just started playing with [knockout.Js](https://www.mindstick.com/forum/160797/conditional-html-heading-tag-based-on-variable-in-knockout-js) which is a fantastic [framework](https://www.mindstick.com/forum/34615/software-framework-vs-library) Steve's really done well with that one. One thing I can't seem to do at the minute is impliment it with my [Html Helpers](https://www.mindstick.com/blog/589/html-helpers-in-mvc). So for exmaple I've got\
<%: [Html.TextBoxFor](https://www.mindstick.com/forum/33953/what-is-the-difference-between-html-textbox-vs-html-textboxfor)([model](https://yourviews.mindstick.com/view/81334/america-is-reopening-after-corona-lockdown-but-on-swedish-model) => model.Division) %>\
\
but I'd line to use the databind on that but at the minute I cant get the "[data](https://www.mindstick.com/articles/13050/salesforce-aiming-to-dominate-predictive-analytics-with-data-science)-bind" [attribute](https://www.mindstick.com/blog/221/attributes-reflection) into the helper. I've used [attributes](https://www.mindstick.com/articles/13105/2-attributes-that-make-your-odoo-ecommerce-theme-productive-and-engaging) before such as @[class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp), Id etc but this one is tricky due to the - any Ideas.. Ive tried.\
\
<%: Html.TextBoxFor(model => model.SupplierName, new { data-bind = "SupplierName"}) %>\
\
but no joy. we heavily use the [Editor](https://www.mindstick.com/forum/78/how-avoid-the-html-tag-and-remove-the-formating-of-copy-in-ajax-editor) and Text box helpers and I'd really like to integrate these into the Item's with knock out.\

## Replies

### Reply by Anonymous User

This should work.\
<%: Html.TextBoxFor(model => model.SupplierName, new { data_bind = "SupplierName"}) %>\
\
Variable names cannot contain a hyphen (-) but if you use an underscore (_) in an HTML attribute, it is automatically converted to a hyphen when its 'rendered'.\


---

Original Source: https://www.mindstick.com/forum/2330/knockout-js-with-asp-dot-net-mvc

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
