Welcome Guest Search | Active Topics | Sign In | Register

Grid HyperLink Column Options
Sunil
Posted: Friday, January 18, 2008 1:16:25 AM
Rank: Member
Groups: Member

Joined: 1/6/2008
Posts: 13
I need to add a Hyperlink column in my Grid Control.
As per the sample example i have done it this way in the designer

<eo:CustomColumn ClientSideGetText="fuSetHyperlinkValue" >
<EditorTemplate>
<a href="http://www.google.com" >Google</a>
</EditorTemplate>
</eo:CustomColumn>

and included the javascript function

<script language="javascript">
function fuSetHyperlinkValue()
{
return "Test";
}
</script>

Now, when i run the application the hyper link column is blank. Please guide me on this.

Regards,
Sunil

eo_support
Posted: Friday, January 18, 2008 4:43:57 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
EditorTemplate is for editing. It's not used when the column is not in editing mode. Use ButtonColumn or StaticColumn instead.
Sunil
Posted: Sunday, January 20, 2008 10:07:58 PM
Rank: Member
Groups: Member

Joined: 1/6/2008
Posts: 13
I want to display a date value as hyperlink. The Date Value is retrieved from the Database and is bound to the Grid control. Can you show me an example of how to do it with Static Column or Button Column.

Thanks
eo_support
Posted: Monday, January 21, 2008 5:30:18 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You can use DataFormat on a StaticColumn. For example, you can set DataFormat to: <a href="window.alert('hi!');">{0}</a>.

Thanks
Sunil
Posted: Monday, January 21, 2008 10:09:37 PM
Rank: Member
Groups: Member

Joined: 1/6/2008
Posts: 13
Hi,

I am not able to assign query string value to the hyperlink.

Please find the code below.

<eo:StaticColumn Width = "125" DataFormat = "<a href='default.aspx?ReqID=<%# DataBinder.Eval(Container.DataItem,"RequestID") %>'>{0:dd/MM/yyyy hh:mm:ss tt}</a>" DataField="RequestDate" HeaderText="Requested Date" AllowSort="True"></eo:StaticColumn>

The following error is generated.

Type 'EO.Web.StaticColumn' does not have a public property named 'href'.

eo_support
Posted: Tuesday, January 22, 2008 5:10:36 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
You juse can not! You can not use both fields with the same StaticColumn! You might have to create an additional computed field that is exactly the link you want to be.
Vanessa
Posted: Tuesday, February 1, 2011 3:57:05 AM
Rank: Newbie
Groups: Member

Joined: 2/1/2011
Posts: 1
This is an old post but maybe my solution could be useful for someone.
I had the same problem and I've found the following solution:

1) add a ButtonColumn
<eo:ButtonColumn HeaderText="Description" DataField="MyFieldDescription" Width="250" ReadOnly="True" AllowSort="true" CommandName="openNewWindow"></eo:ButtonColumn>

2) add a javascript to handle the grid_item_command and open the new window getting the id from another cell
function grid_itemcommand_handler(grid, itemIndex, colIndex, commandName) {

if (commandName == "openNewWindow") {
//Get the grid item
var gridItem = grid.getItem(itemIndex);
//Get the grid cell
var gridCell = gridItem.getCell(2);
//Get the value
var serialE = gridCell.getValue();

window.open('../default.aspx?ApriScheda=' + serialE);
}

}


eo_support
Posted: Tuesday, February 1, 2011 10:20:37 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Cool. Thanks for sharing!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.