Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > Visual Web Developer 2005
|
Visual Web Developer 2005 Discuss creating ASP.NET 2.0 sites with Microsoft's Visual Web Developer 2005. If your question is more specific to a piece of code than the Visual tool, see the ASP.NEt 2.0 forums instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Web Developer 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 27th, 2007, 12:41 PM
Authorized User
 
Join Date: Aug 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default hyperlinkcolumn link to different pages

Hi, I have a datagrid that contains a hyperlinkcolumn. I have a fee_report_type that has report type of "COMPLAINT" and the rest of them. If the report type is "COMPLAINT" then it will to one page, and rest of them will go to the other. I've been trying to work on it and still couldn't figure it out. Here is my HTML:

<Columns>
     <asp:HyperLinkColumn Text="Select"></asp:HyperLinkColumn>
     <asp:BoundColumn DataField="Fee_Report_Type" HeaderText="Report Type"></asp:BoundColumn>
     <asp:BoundColumn DataField="Fee_Amount" HeaderText="Fee Amount" DataFormatString="{0:C}">
     </asp:BoundColumn>
     <asp:BoundColumn DataField="Fee_Balance" DataFormatString="{0:C}" HeaderText="Balance Due">
     </asp:BoundColumn>
     <asp:BoundColumn DataField="Fee_Paid" HeaderText="Paid Date" DataFormatString="{0:d}">
     </asp:BoundColumn>
     <asp:BoundColumn DataField="Fee_Ref_AG" HeaderText="Ref to AG" DataFormatString="{0:d}">
     </asp:BoundColumn>
     <asp:BoundColumn DataField="Fee_Status" HeaderText="Status"></asp:BoundColumn>
     <asp:TemplateColumn>
     <ItemTemplate>
     <asp:HyperLink runat="server" ID="HyperLink1" NavigateUrl='<%# DataBinder.Eval(Container, "DataItem.Fee_ID") %>'
                            Text="Select"></asp:HyperLink>
     </ItemTemplate>
     </asp:TemplateColumn>
     </Columns>
     </asp:DataGrid>

and here is the code behind it:

    Private Sub dtgFeeReport_ItemDataBound(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dtgFeeReport.ItemDataBound
        If e.Item.ItemType = ListItemType.Item Then
            Dim HyperLink1 As HyperLink = CType(e.Item.FindControl("HyperLink1"), HyperLink)
            Dim Fee_ID As Integer = CType(DataBinder.Eval(e.Item.DataItem, "Fee_ID"), Integer)
            Dim Report_Type As String = CType(DataBinder.Eval(e.Item.DataItem, "Fee_Report_Type"), String)
            If Report_Type = "COMPLAINT" Then
                HyperLink1.NavigateUrl = "LFTS_06b.aspx?Fee_File_Info=" & iPasson & "&Late_Fee_Info=" & Fee_ID
            Else
                HyperLink1.NavigateUrl = "LFTS_03b.aspx?Fee_File_Info=" & iPasson & "&Late_Fee_Info=" & Fee_ID
            End If
        End If
    End Sub


 
Old September 27th, 2007, 12:45 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

It would really help if you'd define "couldn't figure it out".

What is going wrong exactly?

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
 
Old September 27th, 2007, 01:50 PM
Authorized User
 
Join Date: Aug 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

it doesn't go to 2 different pages like I want it to.

 
Old September 27th, 2007, 02:03 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi again,

If you want useful help, please be as specific as you can. I understand that it doesn't go to 2 different pages. I could deduce that from your original post because a) that's what you're trying to accomplish and b) you couldn't figure it out.

But what exactly is happening? Does it go to only one of the pages? Does it not go to any page at all? Do you get an error? Is the NavigateUrl never set? Is the event handler never hit? Does it go to an entirely different page? Are the links not even visible? Bla bla bla and so on and so forth......

So, please provide lots more detail about your problem.

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
 
Old September 27th, 2007, 02:15 PM
Authorized User
 
Join Date: Aug 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

o lol, it must be close to friday. My brain was fried when I typed this. I had 2 records to test this. one with report_type "COMPLAINT" and the other one with non-complaint. When I clicked on the one that is non-complaint, it went to the LFTS_03b.aspx with all the variables. but when I clicked on "COMPLAINT" one, it went to LFTS_03.aspx and didn't pass any variables.

 
Old September 27th, 2007, 02:24 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Did you try to debug this? Does it hit the code in the event handler? Does it hit your If and Else statements?

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
 
Old September 27th, 2007, 03:13 PM
Authorized User
 
Join Date: Aug 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I haven't tried to debug it. The page displays fine. But when I clicked on the hyperlinkcolumn, it doesn't go where I want it to.

 
Old September 27th, 2007, 03:24 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Put a hook on this EventHandler: dtgFeeReport_ItemDataBound is it being fired correctly? My guess is that it is not.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET
Professional IIS 7 and ASP.NET Integrated Programming
Wrox Blox: Introduction to Google Gears
Wrox Blox: Create Amazing Custom User Interfaces with WPF and .NET 3.0
================================================== =========
 
Old September 27th, 2007, 03:32 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
quote:I haven't tried to debug it.
That should really be the first thing to do in cases like this. You can stare (or have others stare for you) at this code for hours without seeing what's going on, while debugging the code can give you an answer in a few seconds.

It may be that your event handler is never hit, or it may be something stupid as Report_Type being stored in the database as "complaint" or it could be one of the other 2.5 million different reasons. With debugging, you will know; you don't need to guess.....

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
 
Old September 27th, 2007, 04:51 PM
Authorized User
 
Join Date: Aug 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, thanks for the help anyway. We decided to go with a different route.






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to design a HyperLinkColumn in Datagrid? taoree ASP.NET 1.0 and 1.1 Basics 12 May 30th, 2007 10:37 AM
Passing value from HyperLinkColumn to UserControl 62vette ASP.NET 1.0 and 1.1 Basics 0 April 19th, 2006 06:16 AM
HyperLinkColumn amantona Classic ASP Professional 2 April 5th, 2004 08:35 AM
HyperLinkColumn amantona ASP.NET Espanol 0 April 5th, 2004 03:35 AM
how to link asp pages without MSvisual Interdev meena Classic ASP Basics 2 October 1st, 2003 08:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.