将参数从gridview传递到其他页面的文本框 [英] passing parameters from gridview to textboxes of other pages

查看:59
本文介绍了将参数从gridview传递到其他页面的文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有两个网页,一个是a.aspx,第二个是b.aspx.
在a.aspx中,我具有带有4列的10条记录的gridview,在b.aspx中,我具有4个文本框. 我的查询是

现在,我想将数据从a.aspx中的gridview传递到文本框b.aspx

你能建议我如何传递参数吗?

N.Nagaraju

Hi,

I have two webpages, one is a.aspx and second is b.aspx.
in a.aspx i have gridview with 10 records with 4 columns, and in b.aspx i have 4 textboxes.
and my query is

Now, i want to pass data from gridview in a.aspx to the textboxes b.aspx

can u please suggest me how to pass parameters.

N.Nagaraju

推荐答案



请讲清楚

Hi,

please come to the point

Page 1

//Create & Build a String Array from the grid column values
string[] arrEmp = { "Emp101", "Abraham Lincoln", "Male", "50" };
//Add the array to Session
Session.Add("arrEmp", arrEmp);

Page 2

//Create & Build a String Array from Session
string[] arrEmpDetails = (string[])Session.Item("arrEmp");

//Assign the values to controls from Array
txtEmployeeID.Text = arrEmpDetails(0);
txtEmployeeName.Text = arrEmpDetails(1);
txtEmployeeGender.Text = arrEmpDetails(2);
txtEmployeeAge.Text = arrEmpDetails(3);


如果您有任何疑问,请告诉我

问候,
thatraja


please let me know if you have any doubt

Regards,
thatraja


取决于需求/安全性/性能/UI实现,可以有多种方法将数据从一页传递到另一页.

其中一个会话已在答案之一中进行了解释.您还可以使用查询字符串,Cookie等(适用于整个页面的各种其他状态管理技术)来传递值.

除此之外,在ASP.NET2.0中添加了一个名为"PreviousPage"的新功能.这是基于UI实现的.单击左右按钮后,将一页发布到另一页-在这种情况下,您可以访问上一页控件,因此有值.
参考:
跨页面发布以获取更多详细信息. [
Depending on the requirement/security/performance/UI implementation, there can be various ways to pass on data from one page to other.

Session being one of them already explained in one of the answers. You can also pass on the values using querystring, cookies, etc (various other state management techiniques that are applicable across the pages)

Adding to all that, In ASP.NET2.0 a new feature called ''PreviousPage'' was added. This is something UI implementation based. Posting one page to another after a button click or so - in this scenario you can access the previous page controls and thus there values.
Refer:
Cross-Page posting for more details.[^]


这篇关于将参数从gridview传递到其他页面的文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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