Using Customised URLs as Hyperlink Columns in ASP.NET DataGrids-VBForums
Results 1 to 4 of 4

Thread: Using Customised URLs as Hyperlink Columns in ASP.NET DataGrids

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2008
    Location
    Scotland
    Posts
    63

    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

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    31,096

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2008
    Location
    Scotland
    Posts
    63

    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.

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    31,096

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

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
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.