简体   繁体   中英

how to add onclick javascript for Dictionary<string, string>?

I have a Dictionary object in my view as

<% System.Collections.Generic.Dictionary<string, string> param= new Dictionary<string, string>();; %>
<% {
    param.Add("id","AdditionalPrincipalAmount");
    param.Add("onblur", "TotalPaymentAmount()");
}  %>

does JavaScript call only work for Dictionary<string, object> or does it also work for Dictionary<string, string> ?

You're creating a dictionary here in your C# code however you don't seem to be doing anything with it.

The Dictionary itself is never present on the front end to the browser which is the main realm of Javascript.

Basically, Javascript has no knowlege of the Dictionary you create in C#.

I could be mistaken, but I don't think you can add an onclick event to a dictionary. A dictionary is a collection, not a control. Not very knowledgable when it comes to MVC, but it doesn't seem logical...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM