在GridView中选择一行 [英] Selecting a Row in GridView

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

问题描述



我正在使用gridview填充数据.

我在页面中有两个文本框.
如果我在gridview中选择一行,那么必须在我的文本框中显示选择行中的值.

如何实现这个概念?

在此先感谢

Hi,

I am using gridview for populating my data.

I have two text boxes in a page.
If I select a row in gridview, then values in select rows have to show in my text box.

How can I implement this concept?

Thanks in advance

推荐答案

尝试一下:

在gridview属性中,双击事件selectedIndexChanged,

hi try this:

in gridview property double click the event selectedIndexChanged,

 protected void grvItems_SelectedIndexChanged(object sender, EventArgs e)
{

 //sample 
 txtID.Text = grvItems.SelectedRow.Cells[1].Text;
}



希望对您有帮助,

如果有帮助,请将其标记为答案

谢谢!



hope it helps,

mark this as answer if it helps you

thanks!


txtName.Text = GridView1.SelectedRow.Cells [0] .Text

其中0是所选行的索引.
例如.

您的表格行是姓名,年龄,出生日期

0 =姓名,1 =年龄,2 =生日

希望你能得到它!

问候,
爱德华
txtName.Text = GridView1.SelectedRow.Cells[0].Text

where 0 is the index of the selected row.
For ex.

Your table rows are Name, Age, Birthdate

0=Name, 1=Age, 2=Birthdate

Hope you get it!

Regards,
Eduard


类似的问题2小时前

如何获取选定行的值从TextBox的Gridview中获取 [
Similar question 2 hours ago

How to get the Values of Selected Row from a Gridview in TextBox[^]

EDIT


sugumar srinuvas写道:
sugumar srinuvas wrote:

我正在项目中使用 devexpress 控件.它不包含selectedrow.cell []属性.如何克服这个问题.

i am using devexpress controls in project. it does not contain selectedrow.cell[] property. how to overcome that..

但是您在问题中没有提及任何相关内容,那么我们如何才能为您提供正确的解决方案,这就是为什么我们要告诉新成员发布完整的详细信息(代码,说明,错误编号和消息等).无论如何请检查

网格视图-行选择 [ ^ ]

But you didn''t mention anything about that in your question, then how can we give you right solution, that''s why we are telling the new members to post complete details(Code, description, error no & message, etc.,) in question. Anyway check this

Grid View - Row Selection[^]


这篇关于在GridView中选择一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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