...

View Full Version : Relative path in gridview



min222002
02-25-2013, 05:31 PM
Hello everyone,
Im trying to make the paths in gridview to be relative. The problem is that I cant get it to work with the standard ~something/whatever.aspx format. Here is the portion of the gridview that has the path (and the parameters I'm passing):



<asp:HyperLinkField DataNavigateUrlFields="AM RC,begin_dt,begin_dt"
DataNavigateUrlFormatString="http://randomsite.com/randompage.aspx?rc={0}&amp;begin={1}end={2}"
DataTextField="AM RC" HeaderText="AM RC" />


I would like to avoid code behind if possible just just in case here it is too in VB - no c# please:



Partial Class sc_am
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub

Public Overloads Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)

End Sub
Private Sub ExportToExcel(ByVal strFileName As String, ByVal dg As GridView)

Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.Charset = ""
Me.EnableViewState = False
Dim oStringWriter As New System.IO.StringWriter
Dim oHtmlTextWriter As New System.Web.UI.HtmlTextWriter(oStringWriter)

GridView1.RenderControl(oHtmlTextWriter)

Response.Write(oStringWriter.ToString())
Response.[End]()


End Sub

Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
ExportToExcel("FW_QSI_Report_Dir.xls", GridView1)
End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

End Sub

Protected Sub rc_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rc.TextChanged

End Sub
End Class



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum