Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trying to pass a parameter...help! 4

Status
Not open for further replies.

koolage

IS-IT--Management
Jan 3, 2005
60
I’m trying to pass a parameter to a navigation url in a hyperlink on a web grid…



Here’s the scenario…



Grid has a hyperlink field:



Field name is : ordernumber

Actual data may be: 1060658



This link sends the user to
I want to pass the field name, ordernumber as a parameter along with the url…
But, I can’t figure out how to do this in the field property window of the grid. Any suggestions?


thanks in advance,
~koolage
 
You need to do it in code. In the ItemDataBound event of the grid, you need to get a reference to the hyperlink, then change the property:
Code:
HyperLink1.NavigateUrl = "Your String Here"

Jim
 
Tip.. It seems the poster knows how to construct and get the parameters from a querystring. I belive they question is how to add it to a hyperlink in a grid in design mode.
 
thanks for the reply so quickly, I'll let you know how it turns out, thanks again!!

~koolage
 
thanks for the tips… but I can’t, for the life of me, figure our how to do this.

All I would like to do is place the orderno on the end of the redirect: I can’t find an ITEM DATABOUND EVENT and I can’t find a way to reference the grid’s hyperlink field through code…. I can do a re-direct from the WhseBLRedirect.aspx page, if I can get the orderno appended to it! ?? Thanks!

~koolage
 
place a hyperlink in your grid..

html fo HL

<asp:HyperLink id=YourHL runat="server" Width="48px" NavigateUrl="" Text='<%# DataBinder.Eval(Container, "DataItem.YourFieldName") %>'>
</asp:HyperLink>

now on your itemdatabound of your grid..

Private Sub dgEditPO_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgEditPO.ItemDataBound

Dim DG As DataGrid = CType(sender, DataGrid)
Dim Item As DataGridItem = e.Item
Dim Lnk As HyperLink
Dim Key As Integer

If Item.ItemIndex > -1 Then
Lnk = CType(Item.FindControl("YourHL"), HyperLink)
Key = CInt(DG.DataKeys.Item(Item.ItemIndex))
Lnk.NavigateUrl = "YourPage.aspx?No=" & Key
End If


you can make changes as you need to..


 
Got It!

I needed a {0} on the end of the nav url…

Thanks alot guys!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top