Add a button to a webpart that enables a text box (C#), getting an error: Cannot implicitly convert type 'bool' to 'string' -


i have added button webpart - want functionality enable disabled text box next it. on deploy, getting error: cannot implicitly convert type 'bool' 'string'

when convert string try overcome issue (jdhfbtn.onclientclick = convert.tostring(jdhftxt.enabled = true);), makes text box editable. looking resolve issue. please forgive ignorance - new c# , web parts, , not advanced in programming. thank you.

here code in question:

    sb.append("</td>");     sb.append("         </tr>");     sb.append("         <tr class=\"row2\">");     sb.append("             <td class=\"rowtextleft\" width=\"25%\">spr/jdhf allotment:</td>");     sb.append("             <td class = \"rowtext\" td width=\"75%\">");                                  lc3 = new literalcontrol(sb.tostring());                                 controls.add(lc3);                                  textbox jdhftxt = new textbox();                                  jdhftxt .id = "txtjdhf";                                  jdhftxt .enabled = false;                                 jdhftxt .width = 100;                                 jdhftxt .text = converttofunding(drace["sprallotment"].tostring());                                  controls.add(jdhftxt);                                  sb = new stringbuilder();                                  lc7 = new literalcontrol();                                 controls.add(lc7);                                 button jdhfbtn = new button();                                 jdhfbtn.id = "btnjdhf";                                 jdhfbtn.cssclass = "plainbutton";                                 jdhfbtn.text = "edit";                                 //jdhfbtn.onclientclick = jdhftxt.enabled = true;                                 //jdhfbtn.attributes.add("onclick, jdhftxt.enabled = true);                                 jdhfbtn.onclientclick = convert.tostring(jdhftxt.enabled = true);                                 controls.add(jdhfbtn);                                 sb = new stringbuilder(); sb.append("</td>"); sb.append("         </tr>"); 

that because assigning value true textbox not comparing. change code convert.tostring(jdhftxt.enabled);

edit after reading comments want:

jdhfbtn.onclientclick =        "document.getelementbyid('" + jdhftxt.clientid + "').disabled = false;" +       "return false;"; 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -