zoukankan      html  css  js  c++  java
  • 所有下划线替换成文本框并且ID不同

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Text.RegularExpressions;


    string sAnswer = "";
    string[] Answer = Regex.Split(lbQuestion.Text, "_+", RegexOptions.IgnoreCase);
    for (int i = 0; i < (Answer.Count() - 1); i++)
    {
    if (Answer[0] == "")
    {
    Answer[0] = "<input type="text" id=txtRightAnswer" + 0 + " style="background-color:#ceedff; border:none; border-bottom:solid 1px black;" />";
    }
    else if (i == (Answer.Count() - 1) && Answer[(Answer.Count() - 1)] == "")
    {
    Answer[(Answer.Count() - 1)] = "<input type="text" id=txtRightAnswer" + (Answer.Count() - 1) + " style="background-color:#ceedff; border:none; border-bottom:solid 1px black;" />";
    }
    else
    {
    Answer[i] += "<input type="text" id=txtRightAnswer" + i + " style="background-color:#ceedff;border:none; border-bottom:solid 1px black;" />";
    }
    }
    for (int j = 0; j < Answer.Length; j++)
    {
    sAnswer += Answer[j];
    }
    Control c = ParseControl(sAnswer);
    Panel1.Controls.Clear();
    Panel1.Controls.Add(c);

  • 相关阅读:
    我所理解的NAT
    H3C防火墙安全策略故障排查思路
    职场建议
    小型企业典型网络内部拓扑
    echo&printf
    笔挺站立 昂首挺胸
    Jordan Peterson 的建议
    刚才思考的两个问题
    高手的见解
    一个企业网络管理人员的注意事项
  • 原文地址:https://www.cnblogs.com/liziqiang/p/3437347.html
Copyright © 2011-2022 走看看