gridview problem

budin

Member
Joined
Aug 25, 2011
Messages
12
Programming Experience
Beginner
hye all,

i have some problem...the situation is,

i have 2 dropdownlist...1st dropdownlist is show the folder name that have in D://, the 2nd dropdownlist shows subfolder in 1st dropdowlist...when user select 1st and 2nd dropdownlist, then click getfile button, the file in folder is shown in gridview.. for example,

user select folder cat in d:// then cat subfolder in food...the path show D:/cat/food/test.txt

the gridview shown the test.txt. if in the food folder have many file, the gridview shown all the file in food folder. my gridview is working already and have hyperlink on filename in gridview. my problem is, the hyperlink not go to the path D:/cat/food/test.txt, the link show my localhost path and folder im working on...

i hope somebody can help me ASAP..

thanks in advance,
 
Is it only when you try to use a gridview that you have this problem with hyperlinks linking to the wrong location, or do you just need help in general with hyperlinks? We will probably need to see some code as well from you ;) I guess just the code that creates your hyperlinks.
 
thanks joe for reply....

this is vb code :

Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
articleList.Visible = False
Getfolder(DropDownList1.SelectedValue)
TextBox1.Text = ""
Label1.Text = ""
End Sub


Private Sub GetFolders() \\this dropdownlist show folder name that have in D:\Data\PA

Dim folders = System.IO.Directory.GetDirectories("D:\Data\PA").Select(Function(source As String) New IO.DirectoryInfo(source))
DropDownList1.DataSource = folders
DropDownList1.DataTextField = "Name"
DropDownList1.DataValueField = "FullName"
DropDownList1.DataBind()
End Sub



Private Sub Getfolder(ByVal folder As String) \\this sub show folder name in sub folder dropdownlist 1
Dim current = New System.IO.DirectoryInfo(folder)
'DropDownList2.DataSource = current.GetFiles
'DropDownList2.DataBind()




Dim folders = System.IO.Directory.GetDirectories(DropDownList1.SelectedValue).Select(Function(source As String) New IO.DirectoryInfo(source))
DropDownList2.DataSource = folders
DropDownList2.DataTextField = "Name"
DropDownList2.DataValueField = "FullName"
DropDownList2.DataBind()


End Sub



Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim FileArray() As String
Dim Item As String = vbNullString
If (DropDownList2.SelectedValue <> "") Then
Dim current = New System.IO.DirectoryInfo(DropDownList2.SelectedValue)


Label1.Text = ""


Dim c As String
c = DropDownList1.SelectedValue
Dim d As String
d = DropDownList2.SelectedValue
Dim f As String
f = TextBox1.Text


Dim dirInfo As New DirectoryInfo(d)
FileArray = Directory.GetFiles(d, "*" + f + "*.*")


For Each Item In FileArray
Item = Replace(Item, d, "*" + f + "*")
Next
If Item = "" Then
Label1.Text = "no image"
articleList.Visible = False




End If


articleList.Visible = True
articleList.DataSource = current.GetFiles("*" + f + "*.*")
articleList.DataBind()
Response.Write(current)

End If


End Sub




this is aspx code :

<asp:HyperLinkField HeaderText="File Name " DataTextField="Name" DataNavigateUrlFields="Name" DataNavigateUrlFormatString="~//PA/{0}" Target="_blank"/>
<asp:BoundField DataField="LastWriteTime" DataFormatString="{0:d}" HeaderText="Last Modified">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="Length" DataFormatString="{0:#,### bytes}" HeaderText="File Size">
<ItemStyle HorizontalAlign="Right" />
</asp:BoundField>
</Columns>


<HeaderStyle BackColor="#B5B56A" Font-Bold="True" Font-Size="14px" ForeColor="Black"
Font-Overline="False" />
<EditRowStyle Font-Size="Small" />
<AlternatingRowStyle BackColor="#EEEEEE" />
</asp:GridView>
<asp:HiddenField ID="retValue" runat="server" />
 
Back
Top