c# - How to pass value in a constructor to enable or disable a button in asp.net control? -
i having constructor on user control main page reinitialize user control.
i tried
//constructor
usercontrol(isnew) { this.btnadd.enabled=true; }
btnadd (aspx button runat server) control want disable.
while compiling not shows error.but while runtime throws error saying btnaddis null. object reference not set instance of object.
btnadd
. thnaks
use page_init event , property.
[browsableattribute(true)] [defaultvalue("true")] public bool isnew { get; set; } protected void page_init(object sender, eventargs e) { btnadd = isnew; }
Comments
Post a Comment