|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Setting DropDownList SelectedValuethose controls is a DropDownList that is bound to a SQL table which is the DataSource. I added an option to the DropDownList to choose <<Add>> with a value of -1. I have a VB class function that inserts a new record and returns the identity. This works but when I try to set the SelectedValue to this new identity I get "'ddlAgentID' has a SelectedValue which is invalid because it does not exist in the list of items." The code to do this is in the Page_Load sub as follows: varControl = row.FindControl("ddlAgentID") If varControl.SelectedValue = -1 Then 'Run class function to create new record in tlkpAgent and return ID lngNewID = DBClass.CreateNewtlkpAgent(txtNewText.Text) 'bind formview fvPatents.DataBind() 'set dropdownlist selectedvalue to new agentid varControl.SelectedValue = lngNewID 'txtNewText.Text = lngNewID.ToString txtNewText.Text = "" End If The new record is getting created but the setting of SelectedValue is giving error. Can anyone help? Thanks. David
Role Based Connections Using SSPI / Impersonating Original Caller
How to delete IIS metabase? Viewstate Encryption Insert Row in GridView using SqlDataSource and update to database ? Double Hop Network Issue HttpHandler for site Gridview formatting - 2nd post Web sites vs web applications Prevent client image caching web.config ignored!?!?! |
|||||||||||||||||||||||