|
-
Mar 9th, 2004, 03:38 PM
#1
Thread Starter
Hyperactive Member
*RESOLVED* Unselect a row in a datagrid.
User enters an item code in a text box and clicks on a button. Program searches for the item code. If it cannot find it, it would list possible item codes related to the user entry in a datagrid.
The datagrid has a SELECT button. When a user clicks on the button, the background color of the row changes from white to yellow. The item code of the row selected is transfered to the text box and user clicks on button for processing.
Now, when user enters a new item code on the test box, and this item code does not exist, the datagrid shows up possible item codes (new databind) but now, I get a row highlighted in yellow.
How do I clear up a selected row in a datagrid so that everytime my grid is shown, no item is pre-selected?
TIF
Last edited by ARPRINCE; Mar 9th, 2004 at 04:32 PM.
-
Mar 9th, 2004, 04:31 PM
#2
Thread Starter
Hyperactive Member
Here's what I did:
ON BINDING....
VB Code:
With dgLookUp
.Visible = True
.DataSource = dataREADER
.DataBind()
.SelectedItemStyle.BackColor = Color.Empty 'NO COLORS
End With
ON SELECTING AN ITEM...
VB Code:
Sub dgLookUp_Selected(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
dgLookUp.SelectedItemStyle.BackColor = Color.Yellow 'CHANGE COLOR
txtItemCode.Text = Trim(e.Item.Cells(1).Text)
dgLookUp.SelectedIndex = -1
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|