问题
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