|
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
|
|
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.
|
|
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
|
|
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
|
|
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'.
|
|
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.
|
|
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); } }
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Cool. Thanks for sharing!
|
|