views:

1643

answers:

2

I've been working on a SharePoint project and I have gone the route of loading User Controls through a custom web part.

I have several web controls where I need to dynamically generate hyperlinks (in a loop from a database) that will call certain functions of the User Control when clicked.

When I'm building my own ASP.NET sites, I just add parameters to the hyperlink and check on the page load to see if I need to run any other code when a hyperlink is click.

I'm starting to realize that this probably won't be very reliable inside the SharePoint environment because I don't control the way web page URLs are formed.

I would prefer to have it post back when the hyperlink is clicked and pass some values, but I'm not sure the best way to approach this.

Could someone point me in the right direction?

Thanks.

A: 

You can still add querystring parameters to the end of any url and your webpart will pick them up. The way you create the url will have to be a little more sophisticated in that you cannot assume yours will be the only query parameters on the url.

The SPHttpUtility has some helpful functions.

Nat
A: 

If you want to avoid the complexity of dealing with and parsing URL's then you need to be using the ASP.NET server controls - the whole idea of them is to abstract out complexity such as that.

http://msdn.microsoft.com/en-us/library/seey0yt3(VS.85).aspx http://www.startvbdotnet.com/aspsite/controls/linkbutton.aspx

Ryan