在DataGrid中有(名称及选择两列,其中“选择”是按钮列),填充数据后,我又加了几条空行凑够15条记录,使得看上去好看些,加完后,空行是不显示任何信息的,包括“选择”这一列,运行后点击有数据行的“选择”后,之前添加的空行中“选择”列出现“选择”两个字了,现在我要问你怎么去掉空行显示的“选择”?
解决方案 »
- Winform做多语种,你有啥看法
- windows mobile 开发中出现 将数据发送到运行IIS的计算机失败.详细查看HRESULT
- TCP 数据选择读取问题
- 关于ACCESS备份还原的问题。
- 有个问题想请教各位,满意答案的我把我的分全散啦
- 急急急急急急,windows 2000 开发环境下 模拟aspnet用户
- Microsoft Enterprise Library 报错“Requested registry access is not allowed.”
- 求高手 c#运行后 总是出现同一个窗体
- 特急:c#中一个令我困惑的输出结果重定向问题,望高手指点
- 绿色程序打不开,是否缺失控件
- [vs2005]我把项目的代码分析打开后,报CA1303警告,但是FORM编辑的时候自动生成的代码都出现这个警告,有什么办法让自动生成的代码不出现
- 菜鸟求教!c#怎样实现客户端浏览器在一定时间内没有刷新页面,客户端的浏览器的页面就自动关闭。
if(不是空行)
{
Button myButton = new Button();
myButton.ID = "btnAddNew";
myButton.Text = "选择";
myButton.CommandName = "select";
e.Cell[1].Controls.Add(myButton);
}
ItemDataBound事件中
if(!e.Item.Cells[0].Text.Equals(string.Empty))
{
Button myButton = new Button();
myButton.ID = "btnAddNew";
myButton.Text = "选择";
myButton.CommandName = "select";
e.Cell[1].Controls.Add(myButton);}
{
if(!e.Item.Cells[0].Text.Equals(string.Empty))
{
Button myButton = new Button();
myButton.ID = "btnAddNew";
myButton.Text = "选择";
myButton.CommandName = "select";
e.Cell[1].Controls.Add(myButton);
}
出错:C:\Inetpub\wwwroot\GWLL\MaterialUse.aspx.cs(256): “System.Web.UI.WebControls.DataGridItemEventArgs”并不包含对“Cell”的定义
应该写成e.Item.Cells[1].Controls.Add(myButton); 吧!
在ItemCreated事件中:
if(不是空行)
{
((LinkButton)e.Item.Cells[1].Controls[0]).Visible=false;}
{
((Button)e.Item.Cells[1].Controls[0]).Visible=false;}
代码要写在ItemDataBound事件里面.
去吃饭了,88
if(!e.Item.Cells[0].Text.Equals(string.Empty))
{
((LinkButton)e.Item.Cells[8].Controls[0]).Visible=false;}执行SQL语句出错:指定的参数已超出有效值的范围。参数名: index//总共有9个字段,第8个是"选择"列!
1.将代码添加到在ItemCreated事件中:
2,((LinkButton)e.Item.Cells[7].Controls[0]).Visible=false;//如果第8个是选择列的话
如果不行的话直接发代码我给你改