问题描述
尊敬的先生,
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.
推荐答案
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控件查看不同页面中的完整记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!