EditItemTemplate问题 [英] EditItemTemplate question

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

问题描述

我怎样才能根据行中另一个单元格中的

值显示我在EditItemTemplate中的文本框?


即我只想要用户根据另一个

单元格中的值编辑其中一个单元格....


我应该在datagrid的ItemDataBound事件中执行此操作。 ..something

like ...

如果e.Item.Cells(8).Text =" 2"然后

不允许在EditItemTemplate中定义的文本框可见

这是什么代码?

结束如果


感谢您的帮助

How can I only display the textbox I have in an EditItemTemplate based on the
value in another cell in the row?

i.e I only want users to edit one of the cells based on the value in another
cell....

Should I do this in the ItemDataBound event of the datagrid...something
like...
If e.Item.Cells(8).Text = "2" Then
dont allow the textbox defined in the EditItemTemplate to be visible
what is the code for this?
End If

Thanks for your help

推荐答案

e.Item.Controls.FindControl(" TextBox''s Id")。 Visible = false;


" NH" < NH@discussions.microsoft.com>在留言中写道

新闻:E4 ********************************** @ microsof t.com ...
e.Item.Controls.FindControl("TextBox''s Id").Visible = false;

"NH" <NH@discussions.microsoft.com> wrote in message
news:E4**********************************@microsof t.com...
我怎样才能在EditItemTemplate中显示基于
行中另一个单元格值的文本框?

即我只希望用户根据另一个
单元格中的值编辑其中一个单元格....

我应该在ItemDataBound事件中执行此操作数据网格...
喜欢...
如果e.Item.Cells(8).Text =" 2"然后
不允许在EditItemTemplate中定义的文本框可见
这是什么代码?
结束如果

感谢您的帮助
How can I only display the textbox I have in an EditItemTemplate based on
the
value in another cell in the row?

i.e I only want users to edit one of the cells based on the value in
another
cell....

Should I do this in the ItemDataBound event of the datagrid...something
like...
If e.Item.Cells(8).Text = "2" Then
dont allow the textbox defined in the EditItemTemplate to be
visible
what is the code for this?
End If

Thanks for your help



感谢您的回复。


我得到一个对象引用没有设置为对象的实例 ;错误



CType(e.Item.FindControl(" txtDaysWriteOffed"),TextBox).Visible = False


EditItemTemplate控件是否可以在ItemDataBound

datagrid事件中引用?它似乎不知道控件?


" Grant Merwitz"写道:
thanks for the reply.

I get a "Object reference not set to an instance of an object" error with
the line
CType(e.Item.FindControl("txtDaysWriteOffed"), TextBox).Visible = False

Should the EditItemTemplate control be referenceable in the ItemDataBound
datagrid event? Its as if it doesnt know about the control?

"Grant Merwitz" wrote:
e.Item.Controls.FindControl(" TextBox''s Id")。Visible = false;

" NH" < NH@discussions.microsoft.com>在消息中写道
新闻:E4 ********************************** @ microsof t.com。 ..
e.Item.Controls.FindControl("TextBox''s Id").Visible = false;

"NH" <NH@discussions.microsoft.com> wrote in message
news:E4**********************************@microsof t.com...
我怎样才能在EditItemTemplate中显示我在文本框中基于
该行中另一个单元格的值?

ie我只希望用户根据另一个
单元格中的值编辑其中一个单元格....

我应该在datagrid的ItemDataBound事件中执行此操作。 .something
喜欢...
如果e.Item.Cells(8).Text =" 2"然后
不允许在EditItemTemplate中定义的文本框可见
这是什么代码?
结束如果

感谢您的帮助
How can I only display the textbox I have in an EditItemTemplate based on
the
value in another cell in the row?

i.e I only want users to edit one of the cells based on the value in
another
cell....

Should I do this in the ItemDataBound event of the datagrid...something
like...
If e.Item.Cells(8).Text = "2" Then
dont allow the textbox defined in the EditItemTemplate to be
visible
what is the code for this?
End If

Thanks for your help




其失败的行是

CType(e.Item.Controls(" txtDaysWriteOffed"),TextBox).Enabled = False


它说输入字符串的格式不正确。


" NH"写道:
the line its failing on is
CType(e.Item.Controls("txtDaysWriteOffed"), TextBox).Enabled = False

Its says "Input string was not in a correct format. "

"NH" wrote:
感谢您的回复。

我得到一个对象引用没有设置为对象的实例。行错误
CType(e.Item.FindControl(" txtDaysWriteOffed"),TextBox).Visible = False

如果EditItemTemplate控件在ItemDataBound中可引用
datagrid事件?它似乎不知道控件?

Grant Merwitz写道:
thanks for the reply.

I get a "Object reference not set to an instance of an object" error with
the line
CType(e.Item.FindControl("txtDaysWriteOffed"), TextBox).Visible = False

Should the EditItemTemplate control be referenceable in the ItemDataBound
datagrid event? Its as if it doesnt know about the control?

"Grant Merwitz" wrote:
e.Item.Controls.FindControl(" TextBox''s Id")。Visible = false;

" NH" < NH@discussions.microsoft.com>在消息中写道
新闻:E4 ********************************** @ microsof t.com。 ..
e.Item.Controls.FindControl("TextBox''s Id").Visible = false;

"NH" <NH@discussions.microsoft.com> wrote in message
news:E4**********************************@microsof t.com...
我怎样才能在EditItemTemplate中显示我在文本框中基于
该行中另一个单元格的值?

ie我只希望用户根据另一个
单元格中的值编辑其中一个单元格....

我应该在datagrid的ItemDataBound事件中执行此操作。 .something
喜欢...
如果e.Item.Cells(8).Text =" 2"然后
不允许在EditItemTemplate中定义的文本框可见
这是什么代码?
结束如果

感谢您的帮助
How can I only display the textbox I have in an EditItemTemplate based on
the
value in another cell in the row?

i.e I only want users to edit one of the cells based on the value in
another
cell....

Should I do this in the ItemDataBound event of the datagrid...something
like...
If e.Item.Cells(8).Text = "2" Then
dont allow the textbox defined in the EditItemTemplate to be
visible
what is the code for this?
End If

Thanks for your help




这篇关于EditItemTemplate问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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