【问题标题】:Reading data from database and setting data to value in input type in html从数据库中读取数据并将数据设置为 html 中输入类型的值
【发布时间】:2014-09-15 17:22:52
【问题描述】:

嗨,我有问题要解决。我从数据库设置数据中读取数据到 javascript 中的文本值。但是页面中的值数据没有正确显示。例如,如果值等于 value="hello friends"看到“你好”。我怎么解决这个问题。

这里是代码:-

    <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();

【问题讨论】:

  • 你想在这里做什么???

标签: javascript asp.net-mvc text default-value


【解决方案1】:

引号有问题。试试这个;

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

谢谢!

【讨论】:

    猜你喜欢
    • 2013-06-26
    • 2015-01-13
    • 2022-11-04
    • 1970-01-01
    • 2012-08-10
    • 1970-01-01
    • 1970-01-01
    • 2012-08-17
    • 2012-02-25
    相关资源
    最近更新 更多