i have create a user control search.ascx with query string values and i m accessing this page from Parent page(Rcomm.aspx) and now this Page is open from another page(view.apsx) on button click using hyperlink navigateurl. my question is that how can i pass my user control query string from view.aspx
C# – Pass Query String to User Control from Parent Page
asp.netcuser-controls
Related Topic
- C# – How to create a dropdownlist from an enum in ASP.NET MVC
- C# – Calling a method in parent page from user control
- C# – Pass Method as Parameter using C#
- C# – Split a string by another string in C#
- C# – Call one constructor from another
- Scala: list.flatten: no implicit argument matching parameter type (Any) = > Iterable[Any] was found
Best Answer
A user control has access to the page's URL the same as any normal ASP.NET page does; thus, in order to retrieve the
QueryString
from the user control, the normal syntax will work:However, I consider this poor style, because I think of user controls as a modular item you can embed in ANY page: thus tying it directly to a particular querystring value seems to go against that. However you may have valid reasons for this.
I'm not sure I understand the second part of your question:
Could you please clarify?
ADDITIONAL: OK it seems to me like you have a link in your user control, and want to use a querystring value from the user control's parent page (Rcomm.aspx) to use in the link to a third page. Correct me if I am wrong.
In this case, you would read the querystring from the user control, then append to another URL using NavigateURL:
Or something similar. Yes?