asp.net mvc - How to disable radiogroup? -


i doing application in asp.net mvc. have radiobuttongroup set yes , want disable it. radiobutton group..

@html.radiobutton("rdogp_pritenant", "rdogp_pritenantyes", true)<label>yes</label> @html.radiobutton("rdogp_pritenant", "rdogp_pritenantno", false)<label>no</label> 

i tried

document.getelementbyid("rdogp_pritenant").disabled = true; 

but didnt work.can pls help..??

lets take in msdn: inputextensions.radiobutton method (htmlhelper, string, object, object)

there constructor:

public static mvchtmlstring radiobutton(     htmlhelper htmlhelper,     string name,     object value,     object htmlattributes ) 

you have property htmlattributes, put advanced html attributes (for example new { disabled = "disabled" }):

@html.radiobutton("rdogp_pritenant", "rdogp_pritenantyes", true, new { disabled = "disabled" })<label>yes</label> @html.radiobutton("rdogp_pritenant", "rdogp_pritenantno", true, new { disabled = "disabled" })<label>no</label> 

Comments

Popular posts from this blog

android - Inheriting from Theme.AppCompat* -

broadcastreceiver - android BOOT_COMPLETED not received if not activity intent-filter -

basic authentication with http post params android -