473,387 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Hyperlink on a datagrid

Hi,
I am using a hyperlink on a datagrid (templatecolumn) to display a
link. Onclick of this link I want to open a new window without tool bar
& with certain width & height.
I am using this code

<ASP:TEMPLATECOLUMN HEADERTEXT="Details">
<ITEMTEMPLATE>
<ASP:HYPERLINK ID="lnkDetails" RUNAT="server" NAVIGATEURL='<%#
"Details.aspx?ID=" + DataBinder.Eval(Container.DataItem,"ID")%>'
TARGET="_blank" TEXT="Details"></ASP:HYPERLINK>
</ITEMTEMPLATE>
</ASP:TEMPLATECOLUMN>

This opens a new window but with toolbar & default width & height.

I also tried the following:

NAVIGATEURL="javascript:window.open('Details.aspx? ID=" + <%#
DataBinder.Eval(Container.DataItem,"ID")%+
"','width=500,height=500,toolbar=no');"

but it says "The server tag is not well formed."

Can anyone tell me how to open a customized window when I click on
<asp:hyperlink?

Thanks,
Ashish.

Nov 24 '06 #1
1 3520
I found out the solution.

Add the attribute ONCLICK to <asp:hyperlink

<ASP:HYPERLINK ID="lnkDetails" RUNAT="server" NAVIGATEURL='<%#
"Details.aspx?ID=" + DataBinder.Eval(Container.DataItem,"ID")%>'
ONCLICK="javascript:window.open('',target,'toolbar =0,width=600,height=600,scollbars=1')"
TARGET="target" TEXT="Details"></ASP:HYPERLINK>

This works fine!

-Ashish

as****@gmail.com wrote:
Hi,
I am using a hyperlink on a datagrid (templatecolumn) to display a
link. Onclick of this link I want to open a new window without tool bar
& with certain width & height.
I am using this code

<ASP:TEMPLATECOLUMN HEADERTEXT="Details">
<ITEMTEMPLATE>
<ASP:HYPERLINK ID="lnkDetails" RUNAT="server" NAVIGATEURL='<%#
"Details.aspx?ID=" + DataBinder.Eval(Container.DataItem,"ID")%>'
TARGET="_blank" TEXT="Details"></ASP:HYPERLINK>
</ITEMTEMPLATE>
</ASP:TEMPLATECOLUMN>

This opens a new window but with toolbar & default width & height.

I also tried the following:

NAVIGATEURL="javascript:window.open('Details.aspx? ID=" + <%#
DataBinder.Eval(Container.DataItem,"ID")%+
"','width=500,height=500,toolbar=no');"

but it says "The server tag is not well formed."

Can anyone tell me how to open a customized window when I click on
<asp:hyperlink?

Thanks,
Ashish.
Nov 24 '06 #2

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

Similar topics

3
by: Kumar | last post by:
Hi Folks, I have a question regarding conditional hyperlink in datagrid. I want to display Hyperlink if my QID values in (1,4,5,6) other wise i want to display just Qdescription with out...
2
by: damonf | last post by:
I'm currently trying to add an ASP hyperlink to a template column in a datagrid. The normal hyperlink column doesn't give me the ability to add attributes to the item. In my grid there are four...
9
by: Paul | last post by:
Hi I have a data grid with a hyperlink column. the colum has numbers like 00001,000002, ect. Just wondering how to get the text value of the cell as tempstring =...
1
by: D. Shane Fowlkes | last post by:
Hello All. I keep asking for help with this on the www.asp.net forums and nobody seems to be able to help. What I'm trying to accomplish is very simple. I simply want to create a Hyperlink...
3
by: Raja | last post by:
I have a datagrid, it has dropdown box as a column and i have one more column that has hyperlink. The NavigateURL for the hyperlink is to open a new window with a query stirng parameter as the...
6
by: epigram | last post by:
I'm using the DataGrid with AutoGenerateColumns set to false and choosing which columns I want in the grid by using the <Columns> attribute. What I want to do is to create a hyperlink out of one...
3
by: Tim::.. | last post by:
I currently have the following datagrid but want to turn the name and email column into a hyperlink in the codebehind! Can someone please tell me how I achieve this! Thanks Private Sub...
10
by: david | last post by:
Hi, all: I need a help from you about DataGrid control. I created a DataGrid, dg, in design view of .NET visual Stadio and use the builder to add a Hyperlink column to dg. I want to try to assign...
19
by: Joe | last post by:
I have an aspx page (referred to here as page_1) with a datagrid whose first column contains hyperlinks. When a user clicks one of these hyperlinks, he will navigate to another aspx page (referred...
3
by: TPhelps | last post by:
I have a sample of an unbound (autogeneratecolumns is true) sortable/pagable datagrid that works. I want to change one of the columns to a hyperlink. The examples I find use a bound column. I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...

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.