passing a parm

jvcoach23

Centurion
Joined
May 22, 2003
Messages
192
Location
Saybrook, IL
I have a datagrid that I'm using. it has where they can click on a hyperlink that opens up another page based off the value they click on. But what I would also like to do is pass a second parm.. from the first page to the second. Can I do that.

if I can't do that... I could add another column to the datagrid with teh sql that I'm using to populate the datagrid, but then how do you tell it to pass teh value of two different columns in the same row

thanks
shannon
 
I'm a little confused about your question, but is this what you are looking for?

In the templeted column of the datagrid with the hyperlink:
Code:
<asp:HyperLink ID="lnkToPage" Runat="server" NavigateUrl='<%# BuildUrl(DataBinder.Eval(Container.DataItem, "NeededDatabaseValue1"), DataBinder.Eval(Container.DataItem, "NeededDatabaseValue2")) %>'></asp:HyperLink>

In the code-behind:
Code:
Public Function BuildUrl(ByVal objValue1 As Object, ByVal objValue2 As Object) As String
Dim ReturnValue As String = "PageToLinkTo.aspx?"
Try
If Not IsDBNull(objValue1) Then
If CType(objValue1, String).Trim().Length > 0 Then
	ReturnValue += CType(objValue1, String).Trim() & "&"
End If
End If
If Not IsDBNull(objValue2) Then
If CType(objValue2, String).Trim().Length > 0 Then
	ReturnValue += CType(objValue2, String).Trim() & "&"
End If
End If
Return ReturnValue
Catch ex As Exception
Throw New ApplicationException("An error occurred while trying to build the url.", ex)
End Try
End Function
 
I think this is what I'm after.. I'm not very good with asp.. just starting to learn. I'll have to give it a try.

What I was trying to say in my orginal post was that I have a userid that I'd like to pass from page to page.. I figured out how to do that when you click on a button.. but then I have a page that has a grid. I used the hyperlink in the grid to go on to the next page.. but can't figure out how to pass that userid on as well. I used something like this to get the page to load from teh grid column

Code:
<asp:HyperLinkColumn Text="View" DataNavigateUrlField="intTblNoteId" DataNavigateUrlFormatString="MedicalReport.aspx?intTblNoteId={0}">
</asp:HyperLinkColumn>

but I can't get the userid to pass from one page to the next. So I guess I'll try your code. With hopefully this better explination, you may have another alternative...

thanks
shannon
 
Back
Top