ASP .NET网格控件的列值 [英] Asp .net Grid control coloumn value

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

问题描述

我有以下连续格的网格
studentid studentname studentcollegeid(foriegnkey)

现在,当我显示结果studentcollegeid将显示在网格中时,我想显示该ID的大学名称,我该怎么办该bcz子表具有FK,如上文所述,我可以使用任何方法使我显示大学名称而不是id. "h2_lin">解决方案

进行正确的SQL查询或LINQ,然后尝试填充网格控件.例如,假设College 表存在并且包含CollegeID, CollegeName列.然后
SELECT studentid, studentname,collegeName FROM Student INNER JOIN College ON College.CollegeID = Student.StudentCollegeID


希望对您有帮助.


i have grid which has following coloumn
studentid studentname studentcollegeid(foriegnkey)

now when i display result studentcollegeid will displayed in grid i want to show college name against that id how can i do that bcz child table has FK as i explain above can any method so that i display college name instead of id thanks

解决方案

Make proper SQL query or LINQ and try to populate your grid control.E.g, Assuming that College table exists and contains CollegeID, CollegeName columns. Then
SELECT studentid, studentname,collegeName FROM Student INNER JOIN College ON College.CollegeID = Student.StudentCollegeID


I hope this will help you well.


这篇关于ASP .NET网格控件的列值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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