Bob Guthrie
asked on
using asp.net Datalist
would like to click on an item in the list and open a new webpage with the data from the Datalist field
post your code for datalist first (aspx)...
ASKER
I am new to Experts Exchange.
Do I post Code Here, in the comment area ???
Do I post Code Here, in the comment area ???
ASKER
the response "asp.net get gridview datakey from row command" is not valid... I am using a Datalist NOT A Gridview
yes, here comment area... first press "CODE" button above text area, and paste code inside
[ CODE ] ...paste code here ... [ / CODE ]
ASKER
<asp:DataList ID="DataList2" runat="server" BackColor="Gray" BorderColor="#666666"
BorderStyle="None" BorderWidth="2px" CellPadding="3" CellSpacing="2"
Font-Names="Verdana" Font-Size="Small" GridLines="Both" RepeatColumns="11" RepeatDirection="Horizontal"
Width="600px" DataSourceID="MySQL1" DataKeyField="id"
>
<FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
<HeaderStyle BackColor="#333333" Font-Bold="True" Font-Size="Large" ForeColor="White"
HorizontalAlign="Center" VerticalAlign="Middle" />
<HeaderTemplate>
Videos
</HeaderTemplate>
<ItemStyle BackColor="White" ForeColor="Black" BorderWidth="2px" />
<ItemTemplate>
<b></b>
<asp:LinkButton ID="LinkButton1" runat="server" PostBackUrl='<%# getWebSite(Eval("filename")) %>' ><%# Eval("filename") %></asp:LinkButton>
<b>Category:</b>
<asp:Label ID="lblName" runat="server" Text='<%# Eval("catagory") %>'></asp:Label>
<br />
</ItemTemplate>
</asp:DataList>
Code Behind:
Function getWebSite(str As String) As String
getWebSite = "~/videos/golf/" & str
End Function
Result:405 - HTTP verb used to access this page is not allowed.
The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.
I' have been looking for a work around since searches are of no help with this error.
The following works great for a Gridview:
url = "~/videos/golf/" & FindFileName(strValue)
Dim WinParams As String = "left=100,top=100,width=" & WindowWidth & ",height=" & WindowHeight & ",toolbar=1,resizable=1"
ResponseHelper.Redirect(ur
This is the ultimate goal but with a "Datalist Control"
Thanks
use
PostBackUrl='<%# Server.MapPath("~/videos/golf/") & Eval("filename") %>'
ASKER
The site runs everything under HTTPS.
I get a warning about the page not being secure. But opened anyway(my site).
returns:
"The address wasn’t understood"
The URL: "c:\WWW\Videos\golf\Athlet ic%20Game. mp4"
The URL is accurate.
Server is win 2012 R2
I get a warning about the page not being secure. But opened anyway(my site).
returns:
"The address wasn’t understood"
The URL: "c:\WWW\Videos\golf\Athlet
The URL is accurate.
Server is win 2012 R2
oops, use
ResolveUrl
ResolveUrl
PostBackUrl='<%# ResolveUrl("~/videos/golf/") & Eval("filename") %>'
is this working fine?
PostBackUrl='<%# "~/videos/golf/" & Eval("filename") %>'
ASKER
No Change.
Trying something different.
I tried a PostBackUrl of "https://bing.com" and got a blank page.
But, when I pressed "Enter" on the "https://bing.com" url bar, it went to "https://www.bing.com" and opened normally.
Could this be an issue with the "Control" ???
Trying something different.
I tried a PostBackUrl of "https://bing.com" and got a blank page.
But, when I pressed "Enter" on the "https://bing.com" url bar, it went to "https://www.bing.com" and opened normally.
Could this be an issue with the "Control" ???
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank You very much.
Now I will be able to move on to the original goal.
That worked.
using "<a href='<%# getWebSite(Eval("filename" )) %>' target="_blank"><%# Eval("filename") %></a>"
But I had to change, (in code behind):
From
getWebSite = "~/videos/golf/" & str
To
getWebSite = "../videos/golf/" & str
What I really wanted to do is get the width and height of the video so I could resize the Browser window to fit the Video height and width.
Thanks again
Now I will be able to move on to the original goal.
That worked.
using "<a href='<%# getWebSite(Eval("filename"
But I had to change, (in code behind):
From
getWebSite = "~/videos/golf/" & str
To
getWebSite = "../videos/golf/" & str
What I really wanted to do is get the width and height of the video so I could resize the Browser window to fit the Video height and width.
Thanks again
ASKER
I got muddled down with the "Gridview" thinking because this was the first time I was using the "DataList" control. I knew they were different and was making it entirely to difficult.
Big Thanks to Huseyin
Big Thanks to Huseyin