asp.net - how to add text inside imagebutton while creating it dynamically -


how add text or label inside image button while creating dynamically. have tried

imagebutton imbtn = new imagebutton();                imbtn.id = sname;                imbtn.alternatetext = sname; imbtn.lable=sname;                 imbtn.attributes.add("src", "./image/" + strtext);                imbtn.alternatetext = sname;                imbtn.style.add("height", "50px");                imbtn.style.add("width", "90px");                imbtn.style.add("left", ileft + "px");                panel4.controls.add(imbtn); 

this line 4 not working.

the imagebutton control not have attribute 'lable' guess want use tooltip label control imbtn.tooltip = sname

having normal button control image

// css class

.image-btn-add {          background-image: url("images/add.png") ;         background-repeat: no-repeat;         background-position: left;         background-size: 20px !important;         height: 30px !important;     } 

// .aspx file

 <asp:button id="button1" runat="server" text="     add" cssclass="image-btn-add" /> 

and here dynamic button code behind aspx.cs

   button btn = new button();         btn.id = "button1";         btn.text = "     add";         btn.cssclass = "image-btn-add"; 

and result this

enter image description here


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -