绑定时绑定gridview和substring [英] bind gridview and substring when it bindings

查看:78
本文介绍了绑定时绑定gridview和substring的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



i绑定一个gridview,其中一个列显示这个形式的数据aaa#; 7我想显示只是aaa,我怎样才能删除#; 7绑定时gridview列中的数据结束。



Thnaks

Hi
i bind a gridview and one of the column show the data this form "aaa#;7" i want show just "aaa", how can i remove "#;7" from the end of data in gridview column when it bindings.

Thnaks

推荐答案

如果如何我可以从数据末尾删除#; 7是您的问题



使用以下代码

if "how can i remove "#;7" from the end of data" is your question

use the following code
string s= dt.rows[0]["MyField"].ToString().Replace("#;7","");


该特定列的流程网格&使用行数据绑定事件替换其字符串值。



process grid for that particular column & replace its string value using row data bound event.

string requiredStr = inputStr.Substring(0,inputStr.IndexOf('#'));


这篇关于绑定时绑定gridview和substring的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆