I want to create a web custom control that uses a dropdown list box.
Once I have it created, I know how to use it. My problem is creating it.
I created a new Web Control Library project called MclProgramBox. I renamed the control to cmbPrograms.vb
Is this the right start at least?
I want data loaded into this combo box based on customer login information. For instance, this is the code that I have been using in all my web pages for this dropdown box.
VB Code:
Dim strPriveledge As String Try If (Request.Cookies("Priveledge") Is Nothing) Or Request.Cookies("Priveledge").Value = String.Empty Then Response.Redirect("Login.aspx") End If Catch Response.Redirect("Login.aspx") End Try strPriveledge = Request.Cookies("Priveledge").Value If strPriveledge = "Administrator" Then cmbPrograms.ClearSelection() cmbPrograms.Items.Add("--Select Program--") cmbPrograms.Items.Add("Menu") cmbPrograms.Items.Add("PDI Sales") cmbPrograms.Items.Add("Price Check") 'cmbPrograms.Items.Add("RMS Compare") End If If strPriveledge = "Executive" Then cmbPrograms.ClearSelection() cmbPrograms.Items.Add("--Select Program--") cmbPrograms.Items.Add("Menu") cmbPrograms.Items.Add("PDI Sales") cmbPrograms.Items.Add("Price Check") 'cmbPrograms.Items.Add("RMS Compare") End If If strPriveledge = "District Manager" Then cmbPrograms.ClearSelection() cmbPrograms.Items.Add("--Select Program--") cmbPrograms.Items.Add("Menu") cmbPrograms.Items.Add("PDI Sales") End If If strPriveledge <> "Administrator" And strPriveledge <> "Executive" _ And strPriveledge <> "District Manager" Then Response.Redirect("Login.aspx") End If
For the SelectedIndexChanged event, I want this to happen.
VB Code:
If cmbPrograms.SelectedItem.Text = "Menu" Then Response.Redirect("Menu.aspx") End If If cmbPrograms.SelectedItem.Text = "PDI Sales" Then Response.Redirect("PDISales.aspx") End If If cmbPrograms.SelectedItem.Text = "Price Check" Then Response.Redirect("PriceCheck.aspx") End If If cmbPrograms.SelectedItem.Text = "RMS Compare" Then Response.Redirect("RMSCompare.aspx") End If
I have no idea how to do this for a web custom control. Anyone with patience, I would appreciate if you could be as detailed as possible if you want to give me a hand.
Thanks!




Reply With Quote