使用datatable绑定gridview文本框 [英] bind gridview textbox with datatable

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

问题描述

我有一个gridview,其中1个studentname dropdownliast列和3个textbox列。我希望当我在下拉列表中选择一个学生时,其他3列是自动填写...其中我想显示父姓,课程,学期。





i我正在使用这个sql--





 sql =  选择代码*,来自学生& _ 
关于course.courseid = student.courseid的内部联接课程& _
其中admissionno ='&入学没有& '
Dim dt As DataTable = Hari.Utility.db.GetRecodeDT(sql)







如何在下拉列表中绑定gridview文本框更改..

解决方案

1。句柄 DropDownList SelectedIndexChanged 事件。

2.运行查询,获取所需数据。

3.获取您从中选择 DropDownList 的行。

3.为此行指定列值获取的值。



示例 - 提升DropDownList GridView控件的SelectedIndexChanged [ ^

i have a gridview in which 1 studentname dropdownliast column and 3 textbox column. i want that when i am selecting a student in dropdownlist then the other 3 columns are auto fill.. in which i want to show fathername,course,semester.


i am using this sql--


sql = " select code,* from student " & _
                " inner join course on course.courseid=student.courseid " & _
                " where admissionno='" & AdmissionNo & "'"
          Dim dt As DataTable = Hari.Utility.db.GetRecodeDT(sql)




how can i bind gridview textbox on dropdownlist change..

解决方案

1. Handle DropDownList SelectedIndexChanged Event.
2. Run your query, fetch the required data.
3. Get the Row from which you selected the DropDownList.
3. Assign column values of this Row with the fetched values.

Example - Raising DropDownList SelectedIndexChanged From GridView Control[^]


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

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