473,695 Members | 2,777 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 2214
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
1288
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
3746
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
2100
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
1206
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
7438
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
1026
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
5736
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
2174
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
5651
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
8631
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
8825
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7661
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...
1
6491
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4340
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
4579
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3003
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
2272
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1976
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.