菜鸟笔记

1.c#读取web.config中数据。

c#代码:  string ConnStr = System.Configuration.ConfigurationSettings.AppSettings["aaa"];

web.config里:<appsettings>   <add key="aaa" value="xxxxx"/></appsettings>

2.从数据库里读取的数据 在前台用html标签显示(嘴拙,不会表示。)

用c#拼接好html标签  赋值给前台的一个lable控件。

   StringBuilder str = new StringBuilder();

str.Append("<ul>");

str.Append("<li></li>");

str.Append("<li></li>");

str.Append("</ul>");

 this.lalFun.Text += str.ToString();

3.判断字符串中是否含有某个字符(逗号):

str.IndexOf(",") > -1(判断该字符的索引是否大于-1)

4.将含有逗号的字符串分割:

 string[] strarr = ConnStr.Split(',');

5.判断字符串是否以某个字符开头,是的话就截掉它:

    if (strurl.Substring(0, 1) == "/")
{
  strurl = strurl.Remove(strurl.IndexOf("/"), 1);
  }

6.ajax请求数据:

     $.ajax({
                        type: "POST",
                        contentType: "application/json",
                        url: "index.aspx/updateOrder",
                        data: "{value1:'" + userid + "',value2:'" + text + "',value3:'" + currentGC + "'}",
                        dataType: 'json',
                        success: function (result) {
                            //                            alert(result.d);

                        }
                    });

 

 

  [WebMethod]
    public static bool updateOrder(string value1, string value2, string value3)
    {
        //修改
        var boolResult = BFOA_DeskTop.Scope.HideCol(value1, value2, value3);
        return boolResult;
    }

7.窗体关闭返回数据:

    Response.Write("<script> window.returnValue="xxx ";window.close();</script>");

父窗体接收关闭窗体返回数据:   var returnResult = window.showModalDialog("aaa.html", '',
                 'dialogHeight:600px;dialogWidth:550px;center:yes');

8.刷新本窗体的一种方式:

  window.location.href = "aaa.aspx";

9.移除字符串最后一个字符:

  result = result.Remove(result.LastIndexOf(","), 1);

 

posted on 2014-09-15 17:44  范少敏  阅读(229)  评论(0)    收藏  举报

导航