名称"ids"在当前上下文中不存在?如何解决? [英] The name 'ids' does not exist in the current context?how to solve?

查看:130
本文介绍了名称"ids"在当前上下文中不存在?如何解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道吗?

这是编码产生错误,即"名称" ids"在当前上下文中不存在".

如何解决,在这种情况下,只有字符串pro_id作为QueryString传递,但我希望传递数字.

Can anyone know?

This is the coding produce error that "The name ''ids'' does not exist in the current context".

How to solve, in this only the string pro_id is passed as QueryString but I want number to be passed.

protected void btndetails_Click(object sender, EventArgs e)
{
  string ids="pro_id";
  Response.Redirect("product_details.aspx?ids=" + ids);
}

推荐答案

您所引用的变量(ids)在btndetails_Click过程中不存在.这个价值是从哪里来的?修复该问题,它将对其进行排序.
You are referencing a variable (ids) that doesn''t exist in your btndetails_Click procedure. Where is that value meant to be coming from? Fix that and it will be sorted.


string ids="";
protected void btndetails_Click(object sender, EventArgs e)
{
Response.Redirect("product_details.aspx?ids=" + ids);
}




您必须为ids变量分配值.




You have to assign the value for ids variable..


请确保已定义ID,并且Button_click事件&有一些价值.

有关查询字符串的示例,请参见:
http://csharpdotnetfreak.blogspot.com/2011/09/querystring-in-aspnet.html [^ ]
be sure that ids is defined and it''s scope is available in Button_click event & has some value in it.

for example regarding Query strings refer:
http://csharpdotnetfreak.blogspot.com/2011/09/querystring-in-aspnet.html[^]


这篇关于名称"ids"在当前上下文中不存在?如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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