473,770 Members | 2,143 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 2218
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
1294
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
3749
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
1210
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
7448
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
1035
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
2182
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
5659
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
10260
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10038
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
9910
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
8933
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
7460
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
6712
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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
3609
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.