Clicky

Hi EE,

I have asp.net page (body.aspx),code behind which has user control file(top.ascx), on inline method.

top.ascx has link
<a href ="body.aspx?id=1">menu1</a>
<a href ="body.aspx?id=2">menu2</a>

now i am trying to get value of id on page top.ascx when click the menu links
string id = Request.QueryString["id"]

but it doesnot pass the value. how can I get value in this case?

Thanks

asked 11/24/2011 05:33

saloj's gravatar image

saloj ♦♦


2 Answers:
Hi!

You can create the Public Property  for your UserControl and set that property with the value with QueryString value in
aspx.cs file
This Property of UserControl you can use it in UserControl (.ascx file itself)

Thanks!
link

answered

navneethegde's gravatar image

navneethegde

Like

If you have or create a public property in your control name myID, then in the page's code-behind, in the Page_Load event, add the line

1:
myControl.myID =  Request.QueryString["id"]


and you ccess that property in your usercontrol

Thanks!
link

answered 2011-11-25 at 03:11:39

navneethegde's gravatar image

navneethegde

Your answer
[hide preview]

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×102
×156

Asked: 11/24/2011 05:33

Seen: 249 times

Last updated: 12/14/2011 04:09