datagrid selected item

J

janetb

I'm making first, last, next, prev buttons that are outside of the datagrid.
The labels/buttons that are assigned value/commands respectively based on
which row of the datagrid is selected. Then, if the button outside the
datagrid is pushed, I want it to go to the correct row of the datagrid and
display a hidden cell of the datagrid in a label field. What is the correct
syntax for pulling a datagrid's hidden column based on a button click outside
of the datagrid? If you look at the code below, the correct row in the
datagrid is highlighted when I push the next button, but I can't get the
syntax right to have the lblPgTitle display the hidden cell of the datagrid.
(datagrid cell specifically is DataField="pgTitle")

sub pgNext(sender as object, e as eventArgs)
dim n as integer=cint(lblNext.text)
dgNavList.selectedIndex=n
lblPgTitle.text=dgNavList.item.cells(1).text
end sub

Many thanks for any help.... Janet
 
J

janetb

Tried another tack going through the onSelectedItemChanged in the datagrid
with:

Sub navNav(Sender as object, e as eventArgs)
Dim itemTitle As TableCell =
dgNavList.Items[dgNavList.SelectedIndex].Cells(1)
lblPgTitle.text=convert.toString(itemTitle.text)
End sub

but get an error of identifer expected.

Any ideas? Janet
 
J

janetb

For anybody else out there, here's what worked - did not involve viewState
and did not involve onSelectedIndexChanged by the event method of the button:

sub pgNext(sender as object, e as eventArgs)

dim n as integer=cint(lblNext.text)
dgNavList.selectedIndex=n
Dim itemTitle As TableCell = dgNavList.Items(n).Cells(1)
lblPgTitle.text=convert.toString(itemTitle.text)

end sub


janetb said:
Tried another tack going through the onSelectedItemChanged in the datagrid
with:

Sub navNav(Sender as object, e as eventArgs)
Dim itemTitle As TableCell =
dgNavList.Items[dgNavList.SelectedIndex].Cells(1)
lblPgTitle.text=convert.toString(itemTitle.text)
End sub

but get an error of identifer expected.

Any ideas? Janet

janetb said:
I'm making first, last, next, prev buttons that are outside of the datagrid.
The labels/buttons that are assigned value/commands respectively based on
which row of the datagrid is selected. Then, if the button outside the
datagrid is pushed, I want it to go to the correct row of the datagrid and
display a hidden cell of the datagrid in a label field. What is the correct
syntax for pulling a datagrid's hidden column based on a button click outside
of the datagrid? If you look at the code below, the correct row in the
datagrid is highlighted when I push the next button, but I can't get the
syntax right to have the lblPgTitle display the hidden cell of the datagrid.
(datagrid cell specifically is DataField="pgTitle")

sub pgNext(sender as object, e as eventArgs)
dim n as integer=cint(lblNext.text)
dgNavList.selectedIndex=n
lblPgTitle.text=dgNavList.item.cells(1).text
end sub

Many thanks for any help.... Janet
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top