如何从gridview控件查看不同页面中的完整记录 [英] how to view complete record in a different page from gridview control

查看:77
本文介绍了如何从gridview控件查看不同页面中的完整记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尊敬的先生,
iam在SQL Server 2005中将asp.net3.5与c#一起使用.
iam的员工表包含以下字段


empno int主键
empname varchar(25)
empmail varchar(25)
城市varchar(25)
街道varchar(25)
Flatno varchar(25)

mobileno varchar(25)

iam在gridview中显示数据库中的所有字段.

在gridview中,最后一列是包含链接按钮的tempalte字段.

当我单击此按钮时update.aspx页打开.在页面加载事件中,我必须显示基于empno列的选定记录字段.

您可以举个例子,这样我就可以了.

Dear sir ,
iam using asp.net3.5 with c# with sql server 2005.
iam having employee table which contains the following fields


empno int primary key
empname varchar(25)
empmail varchar(25)
city varchar(25)
street varchar(25)
flatno varchar(25)

mobileno varchar(25)

iam displaying all fields from database in a gridview.

in a gridview the last column is a tempalte field which contains link button .

when i click this button update.aspx page is opened .and at the page load event i have to display the selected record fields based on a empno column.

can you give me example so i can get idea.

推荐答案

您必须将empno作为querystring传递给update.aspx.在update.aspx页面加载中,基于empid从db获取数据并显示内容
you have to pass the empno as querystring to update.aspx. in update.aspx page load get data from db based on empid and display the content


1-One way to resolve this issue is to append empno as a query string against that link button as


lnkbtn. Postbackurl = "update.aspx?empno" + empno


GridView中的


in the GridView.
2-on the Update.aspx page get that parameter from Query string as


int empno = convert.toInt32(Request.QueryString["empno"]


3- pass that empno to the sql query or any other database ur using and got the desired result against that empno.


这篇关于如何从gridview控件查看不同页面中的完整记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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