1

I have a this html code :

<li><a href="Password.aspx" accesskey="2"  >مشاهده</a></li>


I want when i click on the li,to redirect other page,for example:

Response.Redirect("ManagerAdd.aspx");


and i want to send the query string to ManagerAdd page, for example:

Response.Redirect("ManagerAdd.aspx?rid=" + r_id.ToString());


my r_id get from this webform,for example:

how can i write this on li html?

<li><a href="ManagerAddFood.aspx?rid=" + r_id.ToString() accesskey="2"  >مشاهده منو</a></li>


protected void Page_Load(object sender, EventArgs e)
{           
    t1 = Request.QueryString["id"];
}

and i want to get id from form1 load event and send manageradd.aspx with string query.

4
  • 2
    Your query string variable is rid(Response.Redirect("ManagerAdd.aspx?rid=" + r_id.ToString());) so you should access like Request.QueryString["rid"]. Commented Aug 12, 2014 at 9:37
  • so what? what is the question? Commented Aug 12, 2014 at 9:41
  • @zkanoca how can define click event on li html? Commented Aug 12, 2014 at 9:44
  • @zkanoca i update my question,please review. Commented Aug 12, 2014 at 9:45

1 Answer 1

1

at least you can use

<li><a href="ManagerAddFood.aspx?rid=<%=Request.QueryString["r_id"];%>" accesskey="2">مشاهده منو</a></li>

OR

You can give id="link1" and runat="server" attributes to <a> element and make the link at code behind.

<li><a id="link1" runat="server" accesskey="2">مشاهده منو</a></li>

It is important that all items have unique id values.

protected void Page_Load(object sender, EventArgs e)
{           
    //link1.Attributes["href"] = "ManagerAddFood.aspx?rid=" + r_id.ToString()";
    link1.Attributes["href"] = "ManagerAddFood.aspx?rid=" + Request.QueryString["r_id"];
}
Sign up to request clarification or add additional context in comments.

5 Comments

thanks,i write your code,but i get this error:r_id is inaccesible due to its protection level
are you sure it is r_id in your own code? It is not t1, right?
yes i'm sure,and this my code in load event:r_id = query.r_id.ToString();
thanks for pay attention to my problem my dear friend,my problem solve with your help,tnx.
i'm near to you!,i'm from iran-tabriz,my distance from turkey-Van is 400km

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.