This topic is locked
[SOLVED]

 a href in List Page with a column value

1/27/2016 9:41:15 AM
ASPRunner.NET General questions
C
ccvvccc author

Hello everybody,
How can I add an additional a href tag to list page in a new column?
For example I have 3 columns.
What I want to get <a href="mailto:XXX">XXX</a>

XXX is my e_mail column.
I want to create a new temporary column in List page and add a href to this additional <td>. But I want to get value from one of this 3 column. For instance e_mail column.
I tried many ways. I added button.
If I put value as other columns. The value comes with a span inside it and corrupts my href.
I tried to add a button and wrote javascript inside it. Some of my columns becomes null in this way..
In button's Properties Windows, I clear "Client Before" tag. In "Server" tag, I wrote result["txt"] = keys["e_mail"]; in c#. And In "Client After" tab I wrote window.open('http://www.myurl.com/'+result["txt"],'_blank';);
but when I click to button, it just goes http://www.myurl.com/null
??? I am stuck.

jadachDevClub member 1/27/2016

I'm sure there are multiple ways to do this, but the way I do it is to add a new column in the SQL editor. I then display as HTML.

C
ccvvccc author 1/28/2016



I'm sure there are multiple ways to do this, but the way I do it is to add a new column in the SQL editor. I then display as HTML.


Thank you, jadach, for your answer. this solved my problem.
Actually there is another problem now.
What about if I want to create a text based on a value from another column? For example if value in column a is "1", I would like to post "one" to screen.
I can do it by using "if" in sql query. But do you have any other best practise ideas about this scenario?
You have mentioned about other ways of solution. Maybe one of them would be suitable for me.

Thanks again.

Sergey Kornilov admin 1/28/2016

Set 'View as' type of any column to 'Custom'. In this code you can reference any other field from the same record as data["FieldName"].
More info and examples:

http://xlinesoft.com/asprunnernet/docs/_view_as__settings_custom.htm

jadachDevClub member 1/28/2016

Another option is using a case statement right in the sql editor as well. (if it makes sense)

C
ccvvccc author 2/1/2016

Thanks for the answers. I have solved as you both suggested