c# - Color Dialog Displays behind browser -


i created asp.net web forms application , when click on button display color dialog works correctly on first click. subsequent clicks dialog box displays behind browser. noticed posts people had placed color dialog on form. i'm not sure why, color dialog no in toolbox. looking forward answer see id-10-t mistake. thanks!

    protected void button1_click(object sender, eventargs e)     {         colordialog colordialog = new colordialog();         colordialog.anycolor = true;         colordialog.allowfullopen = false;          if (colordialog.showdialog() == dialogresult.ok)         {             string str = null;             str = colordialog.color.name;              if (str.substring(0, 2) == "ff")             {                 str = "#" + str.substring(2);             }              //messagebox.show(str);             lblto.forecolor = system.drawing.colortranslator.fromhtml(str);             lblfrom.forecolor = system.drawing.colortranslator.fromhtml(str);             lbldate.forecolor = system.drawing.colortranslator.fromhtml(str);             lbltime.forecolor = system.drawing.colortranslator.fromhtml(str);              pnlkudos.backcolor = system.drawing.colortranslator.fromhtml(str);             pnlkudos.forecolor = system.drawing.colortranslator.fromhtml(str);             txtbutwait.bordercolor = system.drawing.colortranslator.fromhtml(str);              string stemp = "border: 0px #fff solid;";             txtextra.attributes["style"] = stemp;             stemp = "border-bottom: 1px " + str + " solid;";             txtextra.attributes["style"] = stemp;             stemp = "background-color: " + str;             divkudos.attributes["style"] = stemp;         }     } 

you showing dialog box on server.

it appears work when run code visual studio, that's because server , client happen same machine in instance.

as deploy code real server, code stop working. if you're lucky, you'll exception telling you cannot show dialog box non-interactive process. if not, code hang waiting log in server , close dialog box.

you need use client-side colour picker. google has lots of examples - eg:


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -