Datagrid Row Selected

  • Thread starter Thread starter Luis E Valencia
  • Start date Start date
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?
 
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.
 
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
 
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.
 
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
 
Sorry, I don't get it

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

It inderlines this lin

If e.Item.CommandName = "Pasar" The
 
Back
Top