[已解决]当列为空或空时,如何使用某些默认文本或字符串填充Gridview中的列 [英] [Solved]How I Can Fill Column In Gridview With Some Default Text Or String Only When Column Is Null Or Empty

查看:131
本文介绍了[已解决]当列为空或空时,如何使用某些默认文本或字符串填充Gridview中的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

m在Asp.net中使用GridView控件



这里在我的数据库表m中有一些空行或NULL,

GridView控件与SqlDataSource链接,当GridView显示在网页上时

NULL列显示什么都不是空的。

我怎么能用列中的某些默认文本或字符串填充该列是NULL还是空?

m using GridView control in Asp.net

here in my database table m having some row empty or NULL,
GridView control is linked with SqlDataSource, When GridView is displayed on webpage
NULL column displays nothing it is empty.
how i can fill that column with some default text or string only when column is NULL or Empty ?

推荐答案

您可以在 RowDataBound 事件中获取每个列数据。

因此,在事件中,检查是否为空。

如果为空,则将其替换为任何默认文本。
You can get the each Column Data in RowDataBound Event.
So, inside the Event, check if that is blank or not.
If blank, then replace it with any default text.


yes Tadit Dash我昨天才解决了。

只需在GridView中使用 NullDisplayText 属性

n thanx为你的回复
yes Tadit Dash i have solvedit yesterday only.
by just using NullDisplayText property in GridView
n thanx for your reply


这篇关于[已解决]当列为空或空时,如何使用某些默认文本或字符串填充Gridview中的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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