 |
| 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
|
|
|
|

September 27th, 2007, 12:41 PM
|
|
Authorized User
|
|
Join Date: Aug 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

September 27th, 2007, 01:50 PM
|
|
Authorized User
|
|
Join Date: Aug 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
it doesn't go to 2 different pages like I want it to.
|
|

September 27th, 2007, 02:03 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

September 27th, 2007, 02:15 PM
|
|
Authorized User
|
|
Join Date: Aug 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|

September 27th, 2007, 03:13 PM
|
|
Authorized User
|
|
Join Date: Aug 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|

September 27th, 2007, 03:24 PM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
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
================================================== =========
|
|

September 27th, 2007, 03:32 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

September 27th, 2007, 04:51 PM
|
|
Authorized User
|
|
Join Date: Aug 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Well, thanks for the help anyway. We decided to go with a different route.
|
|
 |