|
-
Mar 27th, 2008, 12:53 PM
#1
Thread Starter
PowerPoster
[RESOLVED] Want to create NavigateUrl string in my code
I'll make this short and sweet: I want to generate the NavigateUrl string for a hyperlink in my code, because I create the HyperLink column in my code. So I want to do something like this:
Code:
Dim hyFactor As HyperLink = DirectCast(Me.gvL.Rows(i).FindControl("hyFactor"), HyperLink)
hyFactor.Text = sFactor
hyFactor.NavigateUrl = "Edit_Loss.asp"
sFactor came from a database call I just made.
And that works. The trouble is I want to pass to Edit_Loss.asp two parameters whose values depend on the current row in the grid. So it would look something like:
Edit_Loss.asp?param1={0}¶m2={1}, but in vb how do I tell it where to get 0 and 1 from? Is this doable?
Thanks.
-
Mar 27th, 2008, 01:04 PM
#2
Thread Starter
PowerPoster
Re: Want to create NavigateUrl string in my code
Alternatively, when my asp file does a request("param1") what are my choices, in my aspx file that call the asp file, of ways to give it a param1? In other words, what is the source that the request() goes to to get the value it's looking for?
Thanks.
-
Mar 27th, 2008, 02:43 PM
#3
Re: Want to create NavigateUrl string in my code
You have "i" which is the row in your gridview you're dealing with. Using i, you can also query the datasource of the gridview. Cast the grid's source to dataset, or dataview or datatable or whatever it allows. Once you have that, you have the 'collection'. You can then use i to get the specific property you want, for example
DataSet.Tables(0).Rows(i).Item("field1").ToString() and DataSet.Tables(0).Rows(i).Item("field9").ToString()
-
Mar 28th, 2008, 08:38 AM
#4
Thread Starter
PowerPoster
Re: Want to create NavigateUrl string in my code
Thank you, mendhak.
I think I was making more of it that it was, and it's really just a string operation. So I am doing it like this:
Code:
For i As Integer = 0 To Me.gv.Rows.Count - 1
Dim labelAbbrev As Label = DirectCast(Me.gv.Rows(i).FindControl("lblAbbrev"), Label)
GetData(labelAbbrev.Text, sIk, sTax, sFromDate, sToDate, sUpDate)
Dim hyTax As HyperLink = DirectCast(Me.gv.Rows(i).FindControl("hyTax"), HyperLink)
hyTax.Text = sTax
hyTax.NavigateUrl = "Edit_Tax.asp?tax_ik=" + sIk + "&ldc_abbr=" + labelAbbrev.Text
Next
-
Mar 28th, 2008, 02:44 PM
#5
Re: Want to create NavigateUrl string in my code
 Originally Posted by MMock
Dim hyTax As HyperLink = DirectCast(Me.gv.Rows(i).FindControl("hyTax"), HyperLink)
Woohoo!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|