asp.net网页之间传递值,而不能修改值 [英] Pass Values between asp.net webpages while cannot modify values

查看:93
本文介绍了asp.net网页之间传递值,而不能修改值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用这个,我知道这是不好的:

I am using this and I know it is not good:

protected string GetCompanyUrl (object companyNum, object balance)
    {
        return "./companyDetails.aspx?companyId=" + companyNum.ToString() + "&balance=" + balance.ToString(); 
    }

但是,如果我在url改变平衡值,该页面将显示与错误的平衡值的公司信息。

But if I change the balance value in the url, the page will show the company info with wrong balance values.

于是,我就用会话[平衡] = balance.ToString();
但是,作为平衡距离gridview的,有许多行,它有许多值,并且它不跟踪对应于companyId值的

So I tried to use Session["balance"]=balance.ToString(); but, as balance is from gridview and has many rows, it has many values, and it does not keep track of the values corresponding to the companyId.

谁能帮助吗?

推荐答案

我建议去该

protected string GetCompanyUrl (object companyNum)
{
        return string.Format("~/companyDetails.aspx?companyId={0}",
        companyNum.ToString());
}

在该公司的详细信息页面,挑the公司NUM和查询您的数据库所需的值。如果您需要的用户无法找出确切的公司编号,你可以简单地使用Base64编码和解码。

On the company details page, pick the comapny num and query with your database for required value. If you need your users unable to figure out the exact company number, you can simply use Base64 encoding and decoding.

这篇关于asp.net网页之间传递值,而不能修改值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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