Free Support Forum - aspose.com

Hyperlink column with a databound grid

Using GridWeb, using bound data columns. Need to dynamically (for each row) generate a hyperlink that includes a parameter ("?Id=RecordId"), where Record Id is in a bound data row, but it is not one of the displayed columns; I can display it if it makes life easier.... I cannot use a straight URL, as I need to invoke our portal's javascript function; in MS grids, I use template fields and simply do have an href, e.g. href="BLOCKED SCRIPTEPCM.doNavigate('ShowDetails?recordId=<%# Eval("RecordID") %>')"

How can I do this with Aspose grid Web? If at all possible, I'd like to do it all on the client side for speed pusposes (i.e. the href is best)

Hi,

Thanks for your inquiry.

We will look into it if we can implement it in data binding mode or provide some other way/options for your need. We will get back to you soon.

Thank you.

Hi,

We have enhanced the
hyperlink feature of BindColumn in Aspose.Cells.GridWeb v<st1:chsdate w:st=“on” year=“1899” month=“12” day=“30” islunardate=“False” isrocdate=“False”>2.0.2</st1:chsdate>.2007(attached), please try it now. It will support the client script
function. The following code demonstrates the usage of the script and code
behind:<o:p></o:p>

1. Code Behind:

sheet.BindColumns[5].CommandName = "BLOCKED SCRIPTcell_cmd()";

sheet.BindColumns[5].CommandText = "Go";

2. BLOCKED SCRIPT

function cell_cmd()

{

var id = event.srcElement.parentElement.parentElement.id;

id = id.substring(GridWeb1.id.length+1, id.length);

var arr = id.split("#");

var row = arr[1];

var col = arr[0];

alert(row + "," + col);

window.navigate("http://localhost/Sample.aspx?id=" + GridWeb1.getCellValue(row, 4));

return true; // not postback

}

Hopefully, this can suit your need.



Thank you.

Hi,

Please ignore the code written in the previous post as there might be some script parsing problems regarding the browser, so consequently there might be some invalid code segments in it. Please see the attached screen shot for the valid sample code.

Thank you.

This does the link, but due to CommandText=‘Go’ rather than my data bound value the entire column says “go”, I need to show the bound value and click on the bound value. In my particular case the column shows the name of an item I need to display; clicking on “go” is counter intuitive for a user; everywhere else in our application we click on a name/part number and we are shown the details, we do not have separate “click here to see”, or “go” buttons. When I remove the CommandText=‘Go’, then the script function does not fire.

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

Well, I simply removed sheet.BindColumns[5].CommandText = "Go"; and it works fine (the bind column text is shown as link). Please create a sample application and post it here. We will check it soon.

Thank You & Best Regards,