Reading data from database and setting data to value in input type in html

女生的网名这么多〃 提交于 2019-12-24 22:56:21

问题


Hi I have problem to be solved.I read data from database setting data to text value in javascript .But the value data does not seen in page correctly.For example if the value is equal to value="hello friends " only "hello" is seen . How can I solve this problem.

Here is code :-

    <input type=" + "text" + " value="+login+" id=" + Type + " name=" + Type + " size=" + "40" + " maxlength=" + "200" + " />

show data:-

    <input type=text value=Lütfen kullanıcı adınızı girin id=Kullanıcı  Girisi name=Kullanıcı  Girisi size=40 maxlength=200 />

only Lütfen is seen..

BlockCode:-

    StringBuilder sb = new StringBuilder();
               List<LoginVO> loginVO = new List<LoginVO>();
               loginVO = formBUS.Login(GrpID);
               login = loginVO[0].Value;
               sb.AppendLine("<table cellpadding=\"0\" cellspacing=\"0\" class=\"custom-tablePopup\">");
               sb.AppendLine("<tr><th>" + Type + ":</th> <th><input type=" + "text" + " value="+login+" id=" + Type + " name=" + Type + " size=" + "40" + " maxlength=" + "200" + " /><th></tr>");

               //SaveData(icerik);
               sb.AppendLine("<tr cellpadding=\"0\" cellspacing=\"0\">");
               //sb.AppendLine("<tr><td>" + dr["DrpBanner2"].ToString() + "</td></tr>");
               // icerik = dr["DrpBanner2"].ToString();
               sb.AppendLine("</tr>");
               //icerik = dr["DrpBanner2"].ToString();
               //SaveData(icerik);
               sb.AppendLine("</table>");
               LitformSon.Text += sb.ToString();

回答1:


There is a issue with quotes. Try this;

<input type=" + "\"text\"" + " value=\""+login+"\" id=\"" + Type + "\" name=\"" + Type + "\" size=" + "\"40\"" + " maxlength=" + "\"200\"" + " />

Thanks!



来源:https://stackoverflow.com/questions/24928895/reading-data-from-database-and-setting-data-to-value-in-input-type-in-html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!