naviagte url in Gridview

G

Guest

I am trying to open a new window from a hyperlink control in a gridview
(vb.net).

I have this..
<asp:TemplateField HeaderText="Project" SortExpression="Project">
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" Text='<%# Bind("Project") %>'
runat="server"
NavigateUrl='<%# String.Format("java
script:eek:penWindow('/SomePage.aspx?SomeID={0}','SomeDescription','scrollbars=yes,width=442,height=500');",
((System.Data.DataRowView)Container.DataItem)["SomeField"] as string)
%>'></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>

The navigateURl property is displaying an error "a call to bind mucst be
assigned to a property of a control inside a template".

What am I doing wrong?
 
S

sloan

Here is my Code.
maybe it can help.

<asp:HyperLinkField DataNavigateUrlFields="MYID" HeaderText =
"My Link To MyID"

DataNavigateUrlFormatString="http://www.mysite.com/myfile.asp?id={0}"
Target="_NEW"
DataTextField="MYID" SortExpression="MYID" />


this is inside my
<asp:gridview> and then <Columns> tag.

...
 
G

Guest

is the asp:HyperLinkField field only availabnle in c# or something? I cant
see it in vb.net?
 
E

Edwin Knoppert

The bind seems ok but the NavigateUrl seems not(!)
Maybe to clear this a little you might want to point to a function in this
case.
Also try to use Eval(), useful on some occasions.



NH said:
is the asp:HyperLinkField field only availabnle in c# or something? I cant
see it in vb.net?

NH said:
I am trying to open a new window from a hyperlink control in a gridview
(vb.net).

I have this..
<asp:TemplateField HeaderText="Project" SortExpression="Project">
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" Text='<%# Bind("Project")
%>'
runat="server"
NavigateUrl='<%# String.Format("java
script:eek:penWindow('/SomePage.aspx?SomeID={0}','SomeDescription','scrollbars=yes,width=442,height=500');",
((System.Data.DataRowView)Container.DataItem)["SomeField"] as string)
%>'></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>

The navigateURl property is displaying an error "a call to bind mucst be
assigned to a property of a control inside a template".

What am I doing wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,067
Latest member
HunterTere

Latest Threads

Top