I have a webpart .I add a listviewbyquary in createchildcontrols and a hyperlink in visualwebpart.
i use this
http://graegert.com/featured/using-the-editorpart-to-create-a-custom-listview-web-part
I want get selected item in ListView when hyperlink click. i use this code in webpart
<script >
function geturl()
{
var context = SP.ClientContext.get_current();
this.web = context.get_web();
var listId = SP.ListOperation.Selection.getSelectedList();
var list = this.web.get_lists().getById(listId);
var items = SP.ListOperation.Selection.getSelectedItems(context); //Get selected documents
var itemId = items[0];
var url="@Url"+itemId;
return url;
</script>
and code in Hyperlink
<a href="javascript:geturl()" >click</a>
but don't work .
var context = SP.ClientContext.get_current(); is null
//Edit
This code return the value when i use in list page , but when i use on Webpart , don't work