数据库中字符串
“优秀-10,良好-8,中等-5”怎样在页面中显示成
优秀 10
良好 8
中等 5
注:是在TextBox中显示,等级和分数在不同的TextBox里面。
“优秀-10,良好-8,中等-5”怎样在页面中显示成
优秀 10
良好 8
中等 5
注:是在TextBox中显示,等级和分数在不同的TextBox里面。
解决方案 »
- 关于绑定传值的问题
- 用来判断是否通过验证,这两种写法是一个意思吧?
- 在GridView中用DataTable,定义模板页,PostBack后TextBox值犹在,但dropDownList值没了,请高手解决......
- 这种出错应该如何用debug进行调试~~~~~~~~~~~急~~~~~~~~~~~~~~~~~~~~
- treeview 每个节点后如何在增加一个button
- 移动窗体文字换行问题
- 关于post方法中的特殊字符处理
- 断点问题
- Treeview控件在鼠标移过的时候可不可以不显示阴影,謝謝了,在線等!
- aspx如何连接数据库?
- 3个div怎么就分不开呢,我有一个gridview 和一个iframe
- 如何将.CS文件编译到已经有的DLL中
TextBox1.Text = stringA.split(',')[0].split('-')[1];//"10"
TextBox1.Text = stringA.split(',')[0].split('-')[1];//"10"
string a = "优秀-10,良好-8,中等-5";
string[] tmp = a.Text.Split(',');
this.textBox.text = tmp[0];
this.textBox1.text = tmp[1];
this.textBox2.text = tmp[2];
可从数据库中读的数据,不知道能拆分成多少条啊,就是不知道要用几个TextBox,要用动态的吗?
string[] s = str.Split(new char[2] { '-', ',' });
foreach (string a in s)
{
Console.Write(a+"\r\n");
}
或用正则表达式
http://topic.csdn.net/u/20090914/14/259b6335-996a-4ed3-a217-c863b391e418.html
string strs[]=s.Split(',');
for(int i=0;i<strs.length;i++)
{
(this.Form.FindControl("tb_grade"+i.ToString()) as TextBox).Text=strs[i].ToString().Split('-').GetValue(0).ToString();
(this.Form.FindControl("tb_total"+i.Tostring()) as TextBox).Text=strs[i].ToString().Split('-').GetValue(1).ToString();
}