473,756 Members | 7,019 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

<asp:hyperlin k> , Databinding

Hi all,

The following code is throwing a run time error "The server tag is not well
formed.
"

<ItemTemplate >
<asp:HyperLin k Runat="server" ID="lnkFile"
NavigateUrl="ja vascript:OpenIm age('<%#
DataBinder.Eval (Container.Data Item,"FileName" ) %>');"><%#
DataBinder.Eval (Container.Data Item,"FileName" ) %></asp:HyperLink>
</ItemTemplate>

I am trying to open a file in new window. How can i acheive this?

TIA
Satya
Nov 19 '05 #1
4 2216
Try rewrite the code as follows:
<asp:HyperLin k Runat="server" ID="lnkFile"
NavigateUrl='<% # "javascript:Ope nImage('" +
DataBinder.Eval (Container.Data Item,"FileName" ) + "');" %>'><%#
DataBinder.Eval (Container.Data Item,"FileName" ) %></asp:HyperLink>

HTH

"Satya" <Sa***@discussi ons.microsoft.c om> wrote in message
news:D8******** *************** ***********@mic rosoft.com...
Hi all,

The following code is throwing a run time error "The server tag is not
well
formed.
"

<ItemTemplate >
<asp:HyperLin k Runat="server" ID="lnkFile"
NavigateUrl="ja vascript:OpenIm age('<%# >
DataBinder.Eval (Container.Data Item,"FileName" ) %>');"><%# >
DataBinder.Eval (Container.Data Item,"FileName" ) %></asp:HyperLink>
</ItemTemplate>

I am trying to open a file in new window. How can i acheive this?

TIA
Satya

Nov 19 '05 #2
Hi Grant,

Thanks for the response.

I tried with your code, but still it's not working.
I am not even switch to design mode.

I am posting the code for data grid and Page_load

DataGrid:

<asp:DataGrid id="dgImages" style="Z-INDEX: 101; LEFT: 53px; POSITION:
absolute; TOP: 34px" runat="server"
AutoGenerateCol umns="False">
<Columns>
<asp:TemplateCo lumn HeaderText="Fil e">
<ItemTemplate >
<asp:HyperLin k Runat="server" ID="lnkFile" NavigateUrl='<% #
"javascript:Ope nImage('" + DataBinder.Eval (Container.Data Item,"FileUrl") +
"');"%>'><% # DataBinder.Eval (Container.Data Item,"FileName" )
%></asp:HyperLink>

</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Fil e Type">
<ItemTemplate >
<asp:Label ID="Label2" Runat="server">
<%# DataBinder.Eval (Container.Data Item,"FileType" ) %>
</asp:Label>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Fil e Format">
<ItemTemplate >
<asp:Label ID="Label3" Runat="server">
<%# DataBinder.Eval (Container.Data Item,"FileForma t") %>
</asp:Label>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Use rUploaded">
<ItemTemplate >
<asp:Label ID="Label4" Runat="server">
<%# DataBinder.Eval (Container.Data Item,"UserUploa ded") %>
</asp:Label>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Dat eUploaded">
<ItemTemplate >
<asp:Label ID="Label1" Runat="server">
<%# DataBinder.Eval (Container.Data Item,"DateUploa ded") %>
</asp:Label>
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>
</asp:DataGrid>
page_load:
private void Page_Load(objec t sender, System.EventArg s e)
{
DataTable dtFiles;
DataRow drFile;
dtFiles = new DataTable("Imag es");

dtFiles.Columns .Add("FileName" );
dtFiles.Columns .Add("FileUrl") ;
dtFiles.Columns .Add("FileType" );
dtFiles.Columns .Add("FileForma t");
dtFiles.Columns .Add("Notes");
dtFiles.Columns .Add("UserUploa ded");
dtFiles.Columns .Add("DateUploa ded");

drFile = dtFiles.NewRow( );
drFile["FileName"] = "Closings Title.pdf";
drFile["FileUrl"] = @"http://cal2ac04/ustitle/Closings.pdf";
drFile["FileType"] = "Closings";
drFile["FileFormat "] = "PDF";
drFile["Notes"] = "Closing note";
drFile["UserUpload ed"] = "XYZ";
drFile["DateUpload ed"] = "08/11/2005";
dtFiles.Rows.Ad d(drFile);

drFile = dtFiles.NewRow( );
drFile["FileName"] = "HUD.TIFF";
drFile["FileUrl"] = @"http://cal2ac04/ustitle/HUD.TIFF";
drFile["FileType"] = "HUD";
drFile["FileFormat "] = "Image";
drFile["Notes"] = "Hud Document";
drFile["UserUpload ed"] = "ABC";
drFile["DateUpload ed"] = "08/11/2005";
dtFiles.Rows.Ad d(drFile);

drFile = dtFiles.NewRow( );
drFile["FileName"] = "Buyer_Closing_ Notice.doc";
drFile["FileUrl"] = @"http://cal2ac04/ustitle/Buyer_Closing_N otice.doc";
drFile["FileType"] = "Closings";
drFile["FileFormat "] = "Doc";
drFile["Notes"] = "Closing Notice to buyer";
drFile["UserUpload ed"] = "PQR";
drFile["DateUpload ed"] = "08/11/2005";
dtFiles.Rows.Ad d(drFile);

dgImages.DataSo urce = dtFiles;
dgImages.DataBi nd();

}


--
Satya Rao
"Grant Merwitz" wrote:
Try rewrite the code as follows:
<asp:HyperLin k Runat="server" ID="lnkFile"
NavigateUrl='<% # "javascript:Ope nImage('" +
DataBinder.Eval (Container.Data Item,"FileName" ) + "');" %>'><%#
DataBinder.Eval (Container.Data Item,"FileName" ) %></asp:HyperLink>

HTH

"Satya" <Sa***@discussi ons.microsoft.c om> wrote in message
news:D8******** *************** ***********@mic rosoft.com...
Hi all,

The following code is throwing a run time error "The server tag is not
well
formed.
"

<ItemTemplate >
<asp:HyperLin k Runat="server" ID="lnkFile"
NavigateUrl="ja vascript:OpenIm age('<%# >
DataBinder.Eval (Container.Data Item,"FileName" ) %>');"><%# >
DataBinder.Eval (Container.Data Item,"FileName" ) %></asp:HyperLink>
</ItemTemplate>

I am trying to open a file in new window. How can i acheive this?

TIA
Satya


Nov 19 '05 #3
hmm, try adding Response.Write( ) in front of the strings

<asp:HyperLin k Runat="server" ID="lnkFile" NavigateUrl='<% #
Response.Write( "javascript:Ope nImage('") +
DataBinder.Eval (Container.Data Item,"FileUrl") + Response.Write( "');")
%>'><%# DataBinder.Eval (Container.Data Item,"FileName" ) %></asp:HyperLink>
"Satya" <Sa***@discussi ons.microsoft.c om> wrote in message
news:F1******** *************** ***********@mic rosoft.com...
Hi Grant,

Thanks for the response.

I tried with your code, but still it's not working.
I am not even switch to design mode.

I am posting the code for data grid and Page_load

DataGrid:

<asp:DataGrid id="dgImages" style="Z-INDEX: 101; LEFT: 53px; POSITION:
absolute; TOP: 34px" runat="server"
AutoGenerateCol umns="False">
<Columns>
<asp:TemplateCo lumn HeaderText="Fil e">
<ItemTemplate >
<asp:HyperLin k Runat="server" ID="lnkFile" NavigateUrl='<% #
"javascript:Ope nImage('" + DataBinder.Eval (Container.Data Item,"FileUrl")
+
"');"%>'><% # DataBinder.Eval (Container.Data Item,"FileName" )
%></asp:HyperLink>

</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Fil e Type">
<ItemTemplate >
<asp:Label ID="Label2" Runat="server">
<%# DataBinder.Eval (Container.Data Item,"FileType" ) %>
</asp:Label>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Fil e Format">
<ItemTemplate >
<asp:Label ID="Label3" Runat="server">
<%# DataBinder.Eval (Container.Data Item,"FileForma t") %>
</asp:Label>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Use rUploaded">
<ItemTemplate >
<asp:Label ID="Label4" Runat="server">
<%# DataBinder.Eval (Container.Data Item,"UserUploa ded") %>
</asp:Label>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Dat eUploaded">
<ItemTemplate >
<asp:Label ID="Label1" Runat="server">
<%# DataBinder.Eval (Container.Data Item,"DateUploa ded") %>
</asp:Label>
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>
</asp:DataGrid>
page_load:
private void Page_Load(objec t sender, System.EventArg s e)
{
DataTable dtFiles;
DataRow drFile;
dtFiles = new DataTable("Imag es");

dtFiles.Columns .Add("FileName" );
dtFiles.Columns .Add("FileUrl") ;
dtFiles.Columns .Add("FileType" );
dtFiles.Columns .Add("FileForma t");
dtFiles.Columns .Add("Notes");
dtFiles.Columns .Add("UserUploa ded");
dtFiles.Columns .Add("DateUploa ded");

drFile = dtFiles.NewRow( );
drFile["FileName"] = "Closings Title.pdf";
drFile["FileUrl"] = @"http://cal2ac04/ustitle/Closings.pdf";
drFile["FileType"] = "Closings";
drFile["FileFormat "] = "PDF";
drFile["Notes"] = "Closing note";
drFile["UserUpload ed"] = "XYZ";
drFile["DateUpload ed"] = "08/11/2005";
dtFiles.Rows.Ad d(drFile);

drFile = dtFiles.NewRow( );
drFile["FileName"] = "HUD.TIFF";
drFile["FileUrl"] = @"http://cal2ac04/ustitle/HUD.TIFF";
drFile["FileType"] = "HUD";
drFile["FileFormat "] = "Image";
drFile["Notes"] = "Hud Document";
drFile["UserUpload ed"] = "ABC";
drFile["DateUpload ed"] = "08/11/2005";
dtFiles.Rows.Ad d(drFile);

drFile = dtFiles.NewRow( );
drFile["FileName"] = "Buyer_Closing_ Notice.doc";
drFile["FileUrl"] = @"http://cal2ac04/ustitle/Buyer_Closing_N otice.doc";
drFile["FileType"] = "Closings";
drFile["FileFormat "] = "Doc";
drFile["Notes"] = "Closing Notice to buyer";
drFile["UserUpload ed"] = "PQR";
drFile["DateUpload ed"] = "08/11/2005";
dtFiles.Rows.Ad d(drFile);

dgImages.DataSo urce = dtFiles;
dgImages.DataBi nd();

}


--
Satya Rao
"Grant Merwitz" wrote:
Try rewrite the code as follows:
<asp:HyperLin k Runat="server" ID="lnkFile"
NavigateUrl='<% # "javascript:Ope nImage('" +
DataBinder.Eval (Container.Data Item,"FileName" ) + "');" %>'><%#
DataBinder.Eval (Container.Data Item,"FileName" ) %></asp:HyperLink>

HTH

"Satya" <Sa***@discussi ons.microsoft.c om> wrote in message
news:D8******** *************** ***********@mic rosoft.com...
> Hi all,
>
> The following code is throwing a run time error "The server tag is not
> well
> formed.
> "
>
> <ItemTemplate >
> <asp:HyperLin k Runat="server" ID="lnkFile"
> NavigateUrl="ja vascript:OpenIm age('<%# >
> DataBinder.Eval (Container.Data Item,"FileName" ) %>');"><%# >
> DataBinder.Eval (Container.Data Item,"FileName" ) %></asp:HyperLink>
> </ItemTemplate>
>
> I am trying to open a file in new window. How can i acheive this?
>
> TIA
> Satya


Nov 19 '05 #4
You should be carefull with the qoutes. Try

<asp:HyperLin k Runat="server" ID="lnkFile" NavigateUrl='<% #
"javascript:Ope nImage(\'" + DataBinder.Eval (Container.Data Item,"FileUrl") +
"\');" %'><%# DataBinder.Eval (Container.Data Item,"FileName" )
%></asp:HyperLink>

Eliyahu

"Satya" <Sa***@discussi ons.microsoft.c om> wrote in message
news:F1******** *************** ***********@mic rosoft.com...
Hi Grant,

Thanks for the response.

I tried with your code, but still it's not working.
I am not even switch to design mode.

I am posting the code for data grid and Page_load

DataGrid:

<asp:DataGrid id="dgImages" style="Z-INDEX: 101; LEFT: 53px; POSITION:
absolute; TOP: 34px" runat="server"
AutoGenerateCol umns="False">
<Columns>
<asp:TemplateCo lumn HeaderText="Fil e">
<ItemTemplate >
<asp:HyperLin k Runat="server" ID="lnkFile" NavigateUrl='<% #
"javascript:Ope nImage('" + DataBinder.Eval (Container.Data Item,"FileUrl") + "');"%>'><% # DataBinder.Eval (Container.Data Item,"FileName" )
%></asp:HyperLink>

</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Fil e Type">
<ItemTemplate >
<asp:Label ID="Label2" Runat="server">
<%# DataBinder.Eval (Container.Data Item,"FileType" ) %>
</asp:Label>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Fil e Format">
<ItemTemplate >
<asp:Label ID="Label3" Runat="server">
<%# DataBinder.Eval (Container.Data Item,"FileForma t") %>
</asp:Label>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Use rUploaded">
<ItemTemplate >
<asp:Label ID="Label4" Runat="server">
<%# DataBinder.Eval (Container.Data Item,"UserUploa ded") %>
</asp:Label>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Dat eUploaded">
<ItemTemplate >
<asp:Label ID="Label1" Runat="server">
<%# DataBinder.Eval (Container.Data Item,"DateUploa ded") %>
</asp:Label>
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>
</asp:DataGrid>
page_load:
private void Page_Load(objec t sender, System.EventArg s e)
{
DataTable dtFiles;
DataRow drFile;
dtFiles = new DataTable("Imag es");

dtFiles.Columns .Add("FileName" );
dtFiles.Columns .Add("FileUrl") ;
dtFiles.Columns .Add("FileType" );
dtFiles.Columns .Add("FileForma t");
dtFiles.Columns .Add("Notes");
dtFiles.Columns .Add("UserUploa ded");
dtFiles.Columns .Add("DateUploa ded");

drFile = dtFiles.NewRow( );
drFile["FileName"] = "Closings Title.pdf";
drFile["FileUrl"] = @"http://cal2ac04/ustitle/Closings.pdf";
drFile["FileType"] = "Closings";
drFile["FileFormat "] = "PDF";
drFile["Notes"] = "Closing note";
drFile["UserUpload ed"] = "XYZ";
drFile["DateUpload ed"] = "08/11/2005";
dtFiles.Rows.Ad d(drFile);

drFile = dtFiles.NewRow( );
drFile["FileName"] = "HUD.TIFF";
drFile["FileUrl"] = @"http://cal2ac04/ustitle/HUD.TIFF";
drFile["FileType"] = "HUD";
drFile["FileFormat "] = "Image";
drFile["Notes"] = "Hud Document";
drFile["UserUpload ed"] = "ABC";
drFile["DateUpload ed"] = "08/11/2005";
dtFiles.Rows.Ad d(drFile);

drFile = dtFiles.NewRow( );
drFile["FileName"] = "Buyer_Closing_ Notice.doc";
drFile["FileUrl"] = @"http://cal2ac04/ustitle/Buyer_Closing_N otice.doc";
drFile["FileType"] = "Closings";
drFile["FileFormat "] = "Doc";
drFile["Notes"] = "Closing Notice to buyer";
drFile["UserUpload ed"] = "PQR";
drFile["DateUpload ed"] = "08/11/2005";
dtFiles.Rows.Ad d(drFile);

dgImages.DataSo urce = dtFiles;
dgImages.DataBi nd();

}


--
Satya Rao
"Grant Merwitz" wrote:
Try rewrite the code as follows:
<asp:HyperLin k Runat="server" ID="lnkFile"
NavigateUrl='<% # "javascript:Ope nImage('" +
DataBinder.Eval (Container.Data Item,"FileName" ) + "');" %>'><%#
DataBinder.Eval (Container.Data Item,"FileName" ) %></asp:HyperLink>

HTH

"Satya" <Sa***@discussi ons.microsoft.c om> wrote in message
news:D8******** *************** ***********@mic rosoft.com...
Hi all,

The following code is throwing a run time error "The server tag is not
well
formed.
"

<ItemTemplate >
<asp:HyperLin k Runat="server" ID="lnkFile"
NavigateUrl="ja vascript:OpenIm age('<%# >
DataBinder.Eval (Container.Data Item,"FileName" ) %>');"><%# >
DataBinder.Eval (Container.Data Item,"FileName" ) %></asp:HyperLink>
</ItemTemplate>

I am trying to open a file in new window. How can i acheive this?

TIA
Satya


Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1290
by: Brandon Taylor | last post by:
Hi everyone, I'm using Visual Web Developer 2005 Beta, VB.NET I'm a complete newbie to .NET, and I'm working through some tutorials in ASP.NET for Dummies. When I add the NavigateURL="" parameter to my <asp:hyperlink> tags, the link will disappear completely when previewed in IE. If I remove the parameter, the link text will appear in IE, but no link. What am I doing wrong? I'd appreciate some help!
5
3748
by: Fresh Air Rider | last post by:
Hello Could anyone please explain how I can pass more than one arguement/parameter value to a function using <asp:linkbutton> or is this a major shortfall of the language ? Consider the following code fragments in which I want to list through all files on a directory with a link to download each file by passing a filename and whether or not to force the download dialog box to appear.
5
2103
by: Ken Dopierala Jr. | last post by:
Hi, This is just a query about what people use most. Up until today I've been using <asp:Table> tags to build my tables. We just outsourced our HTML design to a local guy and when I got it back today I was working with the html <table> <tr> <td> etc. What a difference that makes, server controls are even automatically declared in the code behind when using the generic HTML controls. I think I'm going to switch over to using them...
1
1209
by: Joo Park | last post by:
How do you have a hyperlink that will open up a new window which passes in selected items from a listbox that is on the same page as the hyperlink using <asp:Hyperlink>? thx in advance!
13
7447
by: tperri | last post by:
I have an HTML table with several fields like this: <A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood" ImageUrl="images\buttons\btn-food-i.gif" runat="server"></asp:imagebutton></A> When the user sees these buttons, they will currently be on the savings.aspx?category=whatever page, and when they click another button to look at other categories, all the links I have around these buttons direct to their various categories.
0
1034
by: CharlesA | last post by:
I've got this onn the left of my datagrid <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" HeaderText="Edit" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn> and an ItemCommand event with switch (e.commandname) and even individual events for each command type (update, cancel etc..)
1
5747
by: rn5a | last post by:
Consider the following code: <script runat="server"> Sub Page_Load(obj As Object, ea As EventArgs) Dim sqlReader As SqlDataReader sqlReader = 'calling a function that returns SqlDataReader dlCart.DataSource = sqlReader dlCart.DataBind
1
2177
by: illmagination | last post by:
Hi, I need to display a small pop up message warning the user is leaving the website. At the same time I need to also keep track of who is leaving the website. My problem is that I can't user javascript in asp:hyperlink tags. Should I just use a regular <atag and include the IDs and Runat=Server tags? Here is my code
1
5658
by: khalid sohail | last post by:
hi everybody i want to pass the window size parameter to <asp:hyperlink> attribute Navige URL Property. tell me how to pass the parameter to it.....actually i want to open the new window on the basis to the user click the data in the column i m passing the Query String also to opening page......i have done that work through the datagrid hyperlink column control but the problem was that i cant pass the Querystring to it so that why i m using...
0
9456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9873
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3806
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3359
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.