I have a login panel with a textbox for the userloginID. When the login button is clicked, the datasource is supposed to pick up the valkue in the textbox and provide filtered data to the chklistbox dependent of the value in the userloginID textbox.
I only connect the datasource to the chklistbox when the login button is clicked, but the app still fal;ls over wit the folowing message:
The Type property of parameter 'UserLogin' cannot be set when the DbType property is set. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The Type property of parameter 'UserLogin' cannot be set when the DbType property is set.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: The Type property of parameter 'UserLogin' cannot be set when the DbType property is set.]
System.Web.UI.WebControls.Parameter.GetValue(Object value, Boolean ignoreNullableTypeChanges) +1751307
System.Web.UI.WebControls.ParameterCollection.GetValues(HttpContext context, Control control) +301
System.Web.UI.WebControls.SqlDataSourceView.InitializeParameters(DbCommand command, ParameterCollection parameters, IDictionary exclusionList) +264 System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +472
System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +95
System.Web.UI.WebControls.ListControl.PerformSelect() +34
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +22 System.Web.UI.WebControls.ListControl.OnPreRender(EventArgs e) +18 System.Web.UI.WebControls.CheckBoxList.OnPreRender(EventArgs e) +20 System.Web.UI.Control.PreRenderRecursiveInternal() +80
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
Here is the Login buttons code (onclick):
Protected Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
If btnLogin.Text = "Login" Then
btnLogin.Text = "Logout"
PanelLogin.BackColor = Drawing.Color.LightGreen
Me.CurrentUserLogin = Me.txtUserId.Text
Me.chkLstClientcodes.DataBind()
txtStatus.Text = "Logqed in as Andrew McLintock"
'LoginSuccessInit()
Me.chkLstClientcodes.DataSourceID = "clientcodes"
Else
btnLogin.Text = "Login"
PanelLogin.BackColor = Drawing.Color.LightSalmon
txtStatus.Text = "Not Logged In!!!"
End If
'Me.Page.Controls.Clear()
End
Sub