c# - Adding Attribute to base control of custom control in asp.net -
i have created custom control numeric textbox inherits textbox control. when renders , source of page show me 2 textboxes - 1 id of custom control , other 1 customcontrol's id , appended _txt_ctrl.
i want base control (with _txt_ctrl) should not render. in case if cant it, atleast , can add attribute base control. tried line of no use.
base.attributes.add("title", "this numeric textbox, accepts numbers."); ![error screenshot - additional textbox][1]
protected override void render(htmltextwriter writer) { writer.write("<table id=" + this.clientid + "_tbl" + " width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td>"); base.render(writer); writer.write("</td></tr></table>"); } and init
protected override void oninit(eventargs e) { base.oninit(e); if (this.page.clientscript.isclientscriptblockregistered("numerictextboxscript") == false) { string _strscriptsrc = page.request.applicationpath + "/commonframework/presentation/javascripts/facesnumerictextbox.js"; string strscriptblock = "<script src='" + _strscriptsrc + "'></script>"; this.page.clientscript.registerclientscriptblock(this.gettype(), "numerictextboxscript", strscriptblock); } this.registerclientscriptfunction(); // adding textalign property control's stylesheet. if (this.textalign != null && this.textalign != string.empty) this.style.add("text-align", this.textalign); this.attributes.add("onkeypress", "onkeypress_numericedit(event,'" + this.clientid + "');"); this.attributes.add("onblur", "formatinteger_numericedit('" + this.clientid + "');"); this.attributes.add("maxvalue", _maxvalue.tostring()); this.attributes.add("minvalue", _minvalue.tostring()); this.attributes.add("mindecimalplaces", convert.toint32(_mindecimalplaces).tostring()); this.attributes.add("datamode", convert.toint32(_datamode).tostring()); this.attributes.add("ismaxvalueset", ismaxvalueset.tostring()); this.attributes.add("isminvalueset", isminvalueset.tostring()); this.attributes.add("valuechange", _valuechange); this.attributes.add("title", "this numeric textbox, accepts numbers."); base.attributes.add("title", "this numeric textbox, accepts numbers."); }
Comments
Post a Comment