Microsoft
Software
Hardware
Network
Question : Set SelectedValue of DropdownList in EditItemTemplate of Gridview. Visual Studio 2005.
Set SelectedValue of DropdownList in EditItemTemplate of Gridview. Visual Studio 2005.
When the gridview row Edit button is clicked, the DropDownList displays and is set to the selected value of the first row of the DropDownList SQL statement.
I need to set the selected value to the old value.
The label control of the Gridview contains the old value.
How can I set the selected value to the old value ?
This is my code:
Protected Sub grdPurchases_RowEditing(By
Val sender As Object, ByVal e As System.Web.UI.WebControls.
GridViewEd
itEventArg
s) Handles grdPurchases.RowEditing
Dim intRowIndex As Integer
intRowIndex = e.NewEditIndex 'Row being edited
'Set selected row to the row being edited
grdPurchases.SelectedIndex
= intRowIndex
Dim cboBrokerAccount As DropDownList = CType(grdPurchases.Rows(in
tRowIndex)
.FindContr
ol("cboBro
kerAccount
"), DropDownList)
dscBrokerAccount.SelectCom
mand = _
"SELECT [AccountID], [AccountKey] FROM [Account] " _
& "WHERE [UserID] ='" & txtGridParam.Text & "' ORDER BY [AccountID]"
'Set the selected value of the DropDownList to the OldValue
????
End Sub
Answer : Set SelectedValue of DropdownList in EditItemTemplate of Gridview. Visual Studio 2005.
Looks like to data your binding to doesn't have a column ''AccountID''. I'd start looking there.
If all else fails email me the aspx and the table stucture for your data and I'll take a look at it.
Robert Fidler
Springfield, Missouri
email address is: rfidler at kpmtechnology dot com
Random Solutions
Showsound icon in notification area in Windows 7
How do I deploy Group Policy Preference Client Side Extensions for Windows XP
PCI Modem Compatible with Windows 7 64-bit
How do I install Project 2007 to about 20 users via SMS.
How do I create static NAT on ISA Server 2006
Windows Server Cannot Update Error number: 0x8024D007
Memory Leak error, that only occurs, when i rename my server, and give a specific ip address?
LOAD DATA INFILE - TIMESTAMP, the correct usage
MSASCUI.exe error on XP Pro
Calculate difference in time, and get the integer value