-
Feb 9th, 2015, 05:26 AM
#1
Thread Starter
Lively Member
Using Customised URLs as Hyperlink Columns in ASP.NET DataGrids
Hi
I'm working with a DataGrid object in ASP.NET, which is populated from a SQL Union query. That union query itself draws data from two separate tables in the back-end database.
In the first table I have a column which pads out the identity value with zeros and prefixes the whole thing with "ISS". In the second table I have a similar column, except that the prefix at the beginning of it is "BRE".
What I want to be able to do is to configure the datagrid so that when the column prefix is "ISS", the page that the URL references is called "LogIssue.aspx" with the appropriate parameter. If the column prefix is "BRE", the URL reference would be called "LogBreach.aspx", again with the appropriate parameter.
I've tried building up the formatted string as a column in the stored procedure, but to no avail. Can someone please advise me on this?
Thanks
-
Feb 9th, 2015, 07:54 AM
#2
Re: Using Customised URLs as Hyperlink Columns in ASP.NET DataGrids
Being a strong SQL developer, I'd be inclined to "fix" this from SQL... Can you give an example of your union, the data and what you're expecting?
-tg
-
Feb 9th, 2015, 07:58 AM
#3
Thread Starter
Lively Member
Re: Using Customised URLs as Hyperlink Columns in ASP.NET DataGrids
Hi techgnome
I managed to get the URL to return in the SQL statement, that's not the issue. For reference though, here's the guts of the Stored Procedure:
SELECT BreachID AS ID
,BreachIDAlpha AS IDAlpha
,BreachIdentificationDate AS IdentificationDate
,BreachReporterEmail AS ReporterEmail
,ImpCust.SubCategoryText ImpactedCustomer
,DSB.BreachClientPortfolio AS ClientPortfolio
,DSB.CreatedBy
,DSB.CreatedOn
,'RemedialActionType' = NULL
,'ActionPlanned' = NULL
,'ActionTaken' = NULL
,'URL' = '/frmLogBreach.aspx?ID=' + Cast (DSB.BreachID AS VARCHAR (10))
FROM dbo.DataStoreBreach DSB
INNER JOIN dbo.InformationSubCategory ImpCust
ON ImpCust.SubCategoryID = DSB.BreachImpactedCustomerVolumeID
UNION
SELECT IssueID AS ID
,IssueIDAlpha AS IDAlpha
,IdentificationDate AS IdentificationDate
,ReporterEmail AS ReporterEmail
,ImpCust.SubCategoryText ImpactedCustomer
,DSI.ClientPortfolio AS ClientPortfolio
,DSI.CreatedBy
,DSI.CreatedOn
,'RemedialActionType' = ActionType.SubCategoryText
,'ActionPlanned' = dsi.RemedialActionTargetDate
,'ActionTaken' = DSI.RemedialActionCompleted
,'URL' = '/frmLogIssue.aspx?ID=' + Cast (DSI.IssueID AS VARCHAR (10))
FROM dbo.DataStoreIssue DSI
INNER JOIN dbo.InformationSubCategory ImpCust
ON ImpCust.SubCategoryID = DSI.CustomerImpactVolumeID
INNER JOIN dbo.InformationSubCategory ActionType
ON ActionType.SubCategoryID = DSI.RemedialActionTypeID
The trouble I'm now having is this: how do I get the value that's coming back in the URL column and push that into the datagrid in such a way that it'll be rendered as a URL rather than being displayed as plain text.
-
Feb 9th, 2015, 08:16 AM
#4
Re: Using Customised URLs as Hyperlink Columns in ASP.NET DataGrids
Ah. Don't have any experience with that. I think when you set up the columns in the grid, you can define the url column as a url...
https://msdn.microsoft.com/en-us/lib...=vs.71%29.aspx
I googled datagrid url field
Many results came back.
-tg
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|