hyperlink column in datagrid in web user control  
Author Message
JOSIL





PostPosted: Fri Jul 08 17:34:47 CDT 2005 Top

ASP.Net >> hyperlink column in datagrid in web user control I need 2 different view on spending report for accounting and user. To
accomplish it, I create 2 aspx page AccRpt and UserRpt.

I created a web user control called summary.ascx. In the control, there is
a datagrid which contain a hyperlink column to go to spending detail.

Both AccRpt.aspx and UserRpt.aspx contain summary.ascx.

The web folder structures is:

/Application
/Accounting
/User
/Controls

If an accountant clicks on the link, it should go to accounting/detail.aspx
page. If a regular user clicks, it's supposed to go to user/details.aspx
page

How can I specify the link in the web user control? Thanks

Web Programming339  
 
 
souri





PostPosted: Fri Jul 08 17:34:47 CDT 2005 Top

ASP.Net >> hyperlink column in datagrid in web user control Create a public property in your user control that can set the
Hyperlink control to a given value. Now from your container pages,
setup this URL via the property.
You can ofcourse directly expose the hyperlink in the usercontrol by
making it public, or use 'FindControl' method from the parent pages.
Using a property like above is a better encapsulated way of doing it.