Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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.
C#
protected void btndetails_Click(object sender, EventArgs e)
{
  string ids="pro_id";
  Response.Redirect("product_details.aspx?ids=" + ids);
}
Posted
Updated 22-Nov-11 22:50pm
v4
Comments
sathiyak 23-Nov-11 4:16am    
anyone give soln........
member60 23-Nov-11 4:18am    
better to refer Asp .net QueryString first , have a look at updated solution

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.
 
Share this answer
 
C#
string ids="";
protected void btndetails_Click(object sender, EventArgs e)
{
Response.Redirect("product_details.aspx?ids=" + ids);
}



You have to assign the value for ids variable..
 
Share this answer
 
Comments
sathiyak 23-Nov-11 1:28am    
it shows " The resource cannot be found".....
Prince Antony G 23-Nov-11 23:39pm    
but have mentioned the error "The name 'ids' does not exist in the current context".
Prince Antony G 24-Nov-11 0:06am    
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
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[^]
 
Share this answer
 
v2
Try this

Response.Redirect("product_details.aspx?&ids=" + ids);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900