3.2.0

getting a selected row value

Hi,

Is there a way to assign a value to a row? I can set values to cells easily enough, however I want an onRow click type event that when anywhere on the row is clicked the value assigned to the row would be used,

I understand you can use obj.onCellClicked but the problem I am having is setting a value from my dataSource to the whole row.
Russ
August 4,
Which datasource are you using? You can do anything with js array but with XML or CSV source it would be easier to just add a hidden column.
Alex (ActiveWidgets)
August 4,
it is a dataSet, using VB.net. I already have the data needed in the dataset. I need the whole row to use the value, so in a normal asp.net gridview it would be the 'DataKeyNames' then on the selectedIndexChanged I could get the value for the row.

The idea being when the user clicks a row, the relevent page is loaded, decided on the value of the row. Hope thats a bit clearer now.
Russ
August 4,
No, I was asking how you are sending the data into the web page - as a js array, xml or csv? Can you just add this 'row value' as a new hidden column?
Alex (ActiveWidgets)
August 4,
sorry, I am populating a javascript array in the following way,

var myData = [
<asp:Repeater ID="resultsRepeater" runat="server">
<ItemTemplate>
["<%#DataBinder.Eval(Container.DataItem, "someValue") %>", "..."],
</ItemTemplate>
</asp:Repeater>
];

I could add an extra hidden column (not sure how yet) but how would I reference that value on a row click? i.e. if there were two rows, each cell seperated by || how would i get the value from the HiddenValue when any of the cell is clicked?

row 1 | google | .... | ..... |....| hiddenValue
row 2 | aol | .... | ..... |....| hiddenValue

Thank you for your patience
Russ
August 4,
think I have it sorted,

create a hidden row with whatever text/value I need,

then

obj.onCellClicked = function(event, col, row){document.location.href = this.getCellText(0, row)};

where 0 is the location of a hidden column.
Russ
August 4,
Yes, exactly (and you can also do this in onRowClicked event). Here are also some tips about hiding the grid column -

http://www.activewidgets.com/grid.howto.columns/hide.html
Alex (ActiveWidgets)
August 4,

This topic is archived.

See also:


Back to support forum