Datagrid Row Selected

L

Luis E Valencia

I have many datagrids on a page, and an ItemCommand on one datagrid that
displays another datagrid dependin on what selected in first datagrid on the
VIew Column(Item Command) How Can I keep the first datagird row selected
in another color?
 
L

Luis E Valencia

Cool the second one worked for me.
But
When I select 2 , the last one also stays selected I want to remove the last
selected one.
 
G

Guest

Hi

That's the problem of programmatically control. You have to take care of everything
You can add the following code to reverse the backcolor to normal(if it is white)
Dim di As DataListIte
For Each di In dl.Item
If di.ItemIndex <> e.Item.ItemIndex and di.BackColor <> Color.White The
di.BackColor = Color.Whit
End I
Nex
Of course another way is to remmember the previous selected itemindex. in this case SelectedItemStyle is better
<SelectedItemStyle BackColor="red"></SelectedItemStyle
An
Sub DataList_ItemCommand(sender As Object, e As DataListCommandEventArgs
If e.Item.CommandName = "View" The
DataList.SelectedIndex = e.Item.ItemInde
Datalist.DataBind(
End I
End Sub

Bin Song, MCP
 
L

Luis E Valencia

It is not useful
For Each di In dl.Items


I tried di.Items

but not





Bin Song said:
Hi,

That's the problem of programmatically control. You have to take care of everything.
You can add the following code to reverse the backcolor to normal(if it is white):
Dim di As DataListItem
For Each di In dl.Items
If di.ItemIndex <> e.Item.ItemIndex and di.BackColor <> Color.White Then
di.BackColor = Color.White
End If
Next
Of course another way is to remmember the previous selected itemindex. in
this case SelectedItemStyle is better.
 
G

Guest

Sorry I missed that
You can try SelectedItemStyle
<SelectedItemStyle BackColor="red"></SelectedItemStyle
An
Sub DataGrid_ItemCommand(sender As Object, e As DataGridCommandEventArgs
If e.Item.CommandName = "View" The
DataGrid.SelectedIndex = e.Item.ItemInde
DataGrid.DataBind(
End I
End Sub
 
G

Guest

Sorry, I don't get it

----- Luis E Valencia wrote: ----

It inderlines this lin

If e.Item.CommandName = "Pasar" The
 

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

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top