CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

MS SQL 2008 on ASP.NET Hosting



Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 1/30/2004 7:13:08 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 7 Views: 38 Favorited: 0 Favorite
8 Items, 1 Pages 1 |< << Go >> >|
willzofsteel
Asp.Net User
dropdownlist menu control doesnt do what i tell it!1/30/2004 7:13:08 PM

0/0

Hello everyone,
I am building a composite control that contains 4 dropdownlist. Each dropdown contains options that the user will select to browse to a certain page. Depending on which one they pick,a url is created with the selecteditem as part of the querystring. I want to be able to redirect from the control and not from the page, so first question is, is it even possible because I keep trying and it doesnt seem to work. 2nd if it truly is impossible then how can i get it work at the page level, because when i put my control in the Page_Load sub like this

Sub Page_Load(S as Object, E as EventArgs)

if not IsPostBack then
mydropdownmenu.selectedIndex = 1 'this errors out
end if

if isPostBack then
response.redirect(mydropdownmenu.selectedItem)

'this does nothing, but it wont error

end if

End Sub



and also Im using codebehind for my page, but It seems the only way i can get it to work is by using inline asp tags

so if i do this on the actual page

<%response.redirect(mydropdownMenu.selectedItem)%>


this will actually work. so then my other question is,
in which event are <%%> tags processed.

I thank you for your time reading this and your help.
master4eva
Asp.Net User
Re: dropdownlist menu control doesnt do what i tell it!1/31/2004 6:13:36 AM

0/0

Ok, ok - so how are you doing this on the actual control. I think that you are data binding every post back. So this is the fix if my assumption is correct:

protected override void OnInit(EventArgs e) {
// data binding
base.OnInit(e);
}

-- Justin Lovell
willzofsteel
Asp.Net User
Re: dropdownlist menu control doesnt do what i tell it!2/2/2004 10:15:48 PM

0/0

ok i tryed that and the same thing,
here is the code from my control,


Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Data
Imports System.Data.SqlClient
Imports System.Collections
Imports System.Xml
Imports Mysite

Namespace Skin.SharedControls
Public Class BrowseBar
Inherits SkinControlBase


'The Default properties of the control
Private DefaultPath As String = "../Skins/NavBarControls/DefaultBrowseBar.ascx"
Private GLabel As String = "GENRE"
Private SLabel As String = "STUDIO"
Private PLabel As String = "PERFORMER"
Private DLabel As String = "DIRECTOR"

'The child controls of the control
Private WithEvents ddGenre As DropDownList
Private WithEvents ddStudio As DropDownList
Private WithEvents ddPerformer As DropDownList
Private WithEvents ddDirector As DropDownList


'the event handler
Public Event SelectedIndexChanged(ByVal Sender As Object, ByVal E As EventArgs)

Public ReadOnly Property SelectedItem() As String
Get
If Not ddGenre.SelectedIndex = 0 Then
Return (ddGenre.SelectedValue)
End If

If Not ddStudio.SelectedIndex = 0 Then
Return (ddStudio.SelectedValue)
End If

If Not ddPerformer.SelectedIndex = 0 Then
Return (ddPerformer.SelectedValue)
End If

If Not ddDirector.SelectedIndex = 0 Then
Return (ddDirector.SelectedValue)
End If

End Get
End Property

'The constructor----executes when the page loads each control
Public Sub New()

If VirtualPath = "" Then
VirtualPath = DefaultPath
End If
End Sub

Private Sub SelectedIndexChangedClik(ByVal S As Object, ByVal E As EventArgs)
OnSelectedIndexChanged(EventArgs.Empty)
End Sub

Public Sub OnSelectedIndexChanged(ByVal E As EventArgs)
RaiseEvent SelectedIndexChanged(Me, E)
End Sub


'The Initialize---Initializes the control before rendering
Protected Overrides Sub Initialize(ByVal skincontrol As System.Web.UI.Control)
Dim theList As New ArrayList


'find the child controls on our parent control
Dim GenreLabel As Label = skincontrol.FindControl("GenreLabel")
ddGenre = skincontrol.FindControl("Genre")

Dim StudioLabel As Label = skincontrol.FindControl("StudioLabel")
ddStudio = skincontrol.FindControl("Studio")

Dim PerformerLabel As Label = skincontrol.FindControl("PerformerLabel")
ddPerformer = skincontrol.FindControl("Performer")

Dim DirectorLabel As Label = skincontrol.FindControl("DirectorLabel")
ddDirector = skincontrol.FindControl("Director")



AddHandler ddGenre.SelectedIndexChanged, AddressOf SelectedIndexChangedClik
AddHandler ddStudio.SelectedIndexChanged, AddressOf SelectedIndexChangedClik
AddHandler ddPerformer.SelectedIndexChanged, AddressOf SelectedIndexChangedClik
AddHandler ddDirector.SelectedIndexChanged, AddressOf SelectedIndexChangedClik


GenreLabel.Text = GLabel
StudioLabel.Text = SLabel
PerformerLabel.Text = PLabel
DirectorLabel.Text = DLabel


'Set the dropdown boxes
ddGenre.DataSource = GetGenre()
ddGenre.DataTextField = "GENRE"
ddGenre.DataValueField = "GENRE_ID"
ddGenre.DataBind()


ddStudio.DataSource = GetStudio()
ddStudio.DataTextField = "STUDIO"
ddStudio.DataValueField = "STUDIO_ID"
ddStudio.DataBind()

theList = ABCList() ' this variable holds the characters for the alphabet list

ddPerformer.DataSource = theList
ddPerformer.DataBind()

ddDirector.DataSource = theList
ddDirector.DataBind()

ddGenre.Items.Insert(0, "--Select One--")
ddStudio.Items.Insert(0, "--Select One--")
ddPerformer.Items.Insert(0, "--Select One--")
ddDirector.Items.Insert(0, "--Select One--")

ddGenre.SelectedIndex = ddGenre.Items.IndexOf(ddGenre.Items.FindByText("--Select One--"))
ddStudio.SelectedIndex = ddStudio.Items.IndexOf(ddStudio.Items.FindByText("--Select One--"))
ddPerformer.SelectedIndex = ddPerformer.Items.IndexOf(ddPerformer.Items.FindByText("--Select One--"))
ddDirector.SelectedIndex = ddDirector.Items.IndexOf(ddDirector.Items.FindByText("--Select One--"))

End Sub

Protected Overrides Sub OnLoad(ByVal E As EventArgs)
EnsureChildControls()
End Sub

'Retrieve the Genre info from DB and store in DataSet
Protected Function GetGenre() As DataSet
Dim sqlstr As String = "select * from genre " & _
"Where not ACTIVE_FLAG = 'i' "
Dim WLG As New WantedGlobal
Dim myconnection As New SqlConnection(WLG.ConnString)
Dim mycmd As New SqlCommand(sqlstr, myconnection)
Dim myadapter As New SqlDataAdapter
Dim mydataset As New DataSet

myadapter.SelectCommand = mycmd
myadapter.SelectCommand.Connection.Open()
myadapter.Fill(mydataset)
myadapter.SelectCommand.Connection.Close()

Return (mydataset)


End Function

'Retrieve the Studio " " ----same as above
Protected Function GetStudio() As DataSet
Dim sqlstr As String = "select * from studio " & _
"Where STATUS = 'A' "

Dim WLG As New WantedGlobal
Dim myconnection As New SqlConnection(WLG.ConnString)
Dim mycmd As New SqlCommand(sqlstr, myconnection)
Dim myadapter As New SqlDataAdapter
Dim mydataset As New DataSet

myadapter.SelectCommand = mycmd
myadapter.SelectCommand.Connection.Open()
myadapter.Fill(mydataset)
myadapter.SelectCommand.Connection.Close()

Return (mydataset)

End Function

'Fill an arraylist with the alphabet to bind to our dropdown
Protected Function ABCList() As ArrayList
Dim str As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Dim alphabet As Char
Dim theSource As New ArrayList

For Each alphabet In str
theSource.Add(alphabet)
Next

Return (theSource)
End Function

Public Function Redirect()
Dim response As HttpResponse

response.Redirect(SelectedItem)
End Function
End Class

End Namespace

master4eva
Asp.Net User
Re: dropdownlist menu control doesnt do what i tell it!2/3/2004 5:16:44 PM

0/0

With this method:

Protected Overrides Sub Initialize(ByVal skincontrol As System.Web.UI.Control)
' ...
End Sub

It should be:

Protected Overrides Sub OnInit(ByVal e As EventArgs)
' ...

MyBase.OnInit(e)
End Sub

-- Justin Lovell
willzofsteel
Asp.Net User
Re: dropdownlist menu control doesnt do what i tell it!2/3/2004 7:26:05 PM

0/0

Ok i will try that but what about my base class that the control inherits from.



Imports System
Imports System.Web.UI

Namespace Skin

Public MustInherit Class SkinControlBase
Inherits Control
Implements INamingContainer

Private skinControl As Control
Private skinVirtualPath As String = ""

Public Property VirtualPath() As String
Get
Return skinVirtualPath
End Get

Set(ByVal Value As String)
skinVirtualPath = Value
End Set
End Property

Protected Overrides Sub CreateChildControls()

Controls.Clear()
MyBase.CreateChildControls()

Try

PreInitialize()

Controls.Add(skinControl)

Initialize(skinControl)

Catch ex As Exception
Finally
End Try


End Sub


Private Function PreInitialize()
skinControl = Page.LoadControl(skinVirtualPath)
End Function

Protected MustOverride Sub Initialize(ByVal skincontrol As Control)


End Class
End Namespace



i used this example for my base skin class. What do i need to change in it so that I can do a postback from my control and process redirects only in my control?
Thank you helping me Master4eva, I am really grateful!
master4eva
Asp.Net User
Re: dropdownlist menu control doesnt do what i tell it!2/3/2004 8:03:38 PM

0/0

Hmmm... it looks like my suggestion will work. Obviously, you do not need to declare (or call) the Initialize method if you follow my suggestion.
-- Justin Lovell
willzofsteel
Asp.Net User
Re: dropdownlist menu control doesnt do what i tell it!2/3/2004 9:07:41 PM

0/0

ok here is the OnInit, am i doing this wrong?


Protected Overrides Sub OnInit(ByVal e As EventArgs)
'The Initialize---Initializes the control before rendering
MyBase.OnInit(e)


Dim skincontrol As Control
Dim theList As New ArrayList


'find the child controls on our parent control
Dim GenreLabel As Label = skincontrol.FindControl("GenreLabel")
ddGenre = skincontrol.FindControl("Genre")

Dim StudioLabel As Label = skincontrol.FindControl("StudioLabel")
ddStudio = skincontrol.FindControl("Studio")

Dim PerformerLabel As Label = skincontrol.FindControl("PerformerLabel")
ddPerformer = skincontrol.FindControl("Performer")

Dim DirectorLabel As Label = skincontrol.FindControl("DirectorLabel")
ddDirector = skincontrol.FindControl("Director")

AddHandler ddGenre.SelectedIndexChanged, AddressOf ddIndexChanged
AddHandler ddStudio.SelectedIndexChanged, AddressOf ddIndexChanged
AddHandler ddPerformer.SelectedIndexChanged, AddressOf ddIndexChanged
AddHandler ddDirector.SelectedIndexChanged, AddressOf ddIndexChanged


GenreLabel.Text = GLabel
StudioLabel.Text = SLabel
PerformerLabel.Text = PLabel
DirectorLabel.Text = DLabel


'Set the dropdown boxes
ddGenre.DataSource = GetGenre()
ddGenre.DataTextField = "GENRE"
ddGenre.DataValueField = "GENRE_ID"
ddGenre.DataBind()


ddStudio.DataSource = GetStudio()
ddStudio.DataTextField = "STUDIO"
ddStudio.DataValueField = "STUDIO_ID"
ddStudio.DataBind()

theList = ABCList() ' this variable holds the characters for the alphabet list

ddPerformer.DataSource = theList
ddPerformer.DataBind()

ddDirector.DataSource = theList
ddDirector.DataBind()

ddGenre.Items.Insert(0, "--Select One--")
ddStudio.Items.Insert(0, "--Select One--")
ddPerformer.Items.Insert(0, "--Select One--")
ddDirector.Items.Insert(0, "--Select One--")

ddGenre.SelectedIndex = ddGenre.Items.IndexOf(ddGenre.Items.FindByText("--Select One--"))
ddStudio.SelectedIndex = ddStudio.Items.IndexOf(ddStudio.Items.FindByText("--Select One--"))
ddPerformer.SelectedIndex = ddPerformer.Items.IndexOf(ddPerformer.Items.FindByText("--Select One--"))
ddDirector.SelectedIndex = ddDirector.Items.IndexOf(ddDirector.Items.FindByText("--Select One--"))

End Sub


I just left the old function empty

Protected Overrides Initialization(skincontrol as Control)


I get this when I try to use the onInit function


[NullReferenceException: Object reference not set to an instance of an object.]
Wantedlistv2.Skin.SharedControls.BrowseBar.OnInit(EventArgs e)
System.Web.UI.Control.InitRecursive(Control namingContainer) +240
System.Web.UI.Control.InitRecursive(Control namingContainer) +178
System.Web.UI.Control.InitRecursive(Control namingContainer) +178
System.Web.UI.Page.ProcessRequestMain() +174


Im still pretty new to asp.net but Im trying my best to understand. thank you for your time and help.
master4eva
Asp.Net User
Re: dropdownlist menu control doesnt do what i tell it!2/5/2004 1:51:00 PM

0/0

There is something already that I can already see. It is just the moving of code around:

Protected Overrides Sub OnInit(ByVal e As EventArgs)
' the data binding code goes here

MyBase.OnInit(e) ' this should be called last
End Sub

And regarding the error, which line is it occuring?
-- Justin Lovell
8 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Flash 8: The Missing Manual Authors: Emily A. Vander Veer, Emily A. VanderVeer, Pages: 446, Published: 2006
Vegas 5 Editing Workshop Authors: Douglas Spotted Eagle, Pages: 447, Published: 2004
Vegas Pro 8 Editing Workshop Authors: Douglas Spotted Eagle, Pages: 528, Published: 2008
Dummies 101: Word 97 for Windows Authors: Peter Weverka, Pages: 255, Published: 1997
An Illustrated A to Z of Digital Photography Authors: Nigel Atherton, Steve Crabb, Pages: 176, Published: 2005
Vegas 6 Editing Workshop: DV Expert Series Authors: Douglas Spotted Eagle, Pages: 496, Published: 2005
The Mother of All Windows 98 Books: MOM once again plumbs the depths, this time tackling Windows 98 : introducing Woody and Barry's iconic alter egos and, of course, Billy98 Authors: Woody Leonhard, Barry Simon, Pages: 829, Published: 1998
Beginning ASP.NET 3.5: In C# and VB Authors: Imar Spaanjaars, Pages: 734, Published: 2008
Adobe Premiere Elements for Dummies: For Dummies Authors: Keith Underdahl, Pages: 384, Published: 2004

Web:
Building a Type-Ahead Dropdown Control: ASP Alliance NET DropDownList control does not offer type-ahead functionality. ... This control is awesome but can someone tell me how can we add functionality of ...
Free scrolling dropdown menu Download - scrolling dropdown menu ... In the component inspector/parameters window all you have to do is tell it where to find your menu information (a text file)... but dont worry about ...
Expert Forums: raise exception when get ScreenTop of ... -Do not return the top most control at point. That is I call this function when the mouse point is pointed to menu control, dropdown list, Matched Code ...
attachMovie Action to button within dropdown menu [Archive ... [Archive] attachMovie Action to button within dropdown menu ActionScript 2.0. ... then you can control that button from anywhere like this: ...
ASP 101 - Adding Items to a Data-Bound DropDownList On The Fly in ... from either the SqlDataSource control's Smart Tag menu or by .... Since it's not the focus of the example, submitting the form doesn't do anything. ...
The clear and complete address field dropdown control panel we don ... I suspect that Historysearch doesn't include BH and the others do. ... http://my .opera.com/bpm/blog/the-address-field-dropdown-control-panel-we-dont-have ...
CodeProject: Very Compatible DHTML Menu ASP.NET User Control. Free ... NET User Control. I am using a horizontal menu and do not want the image boxs on ... It doesn't care about rank column, which is supposed to tell which main ...
Menu Control - vBulletin.org Forum This is Menu Control 1.3 for vBulletin version 3.6.0 RC 3. There may be a few bugs, and so it is important you must tell me about any you ...
How do I programatically reference controls inside a control template? but it does not work at all. As far as I can tell, it does not even ... I usually cast the EventArg to a control then > do find control on ...
How to make a simple CSS dropdown menu | evolt.org If they are not links, tell the user to bash his/her head for not using a ... It just so happens that this menu does not work in what is supposedly the ...

Videos:
Developing JavaScript with Chickenfoot Google TechTalks July 25, 2006 Rob Miller Michael Bolin ABSTRACT Chickenfoot is a Firefox extension that embeds a JavaScript programming ...
Long Beach City Council Meeting Long Beach City Council Meeting




Search This Site:










dnn 3.0.4 install log

dnn 2.1.2 to 3.1.3 upgrade error

sql server does not exist or access denied

please help a newbie out...

object reference not set to an instance of an object after what looks like successfull instal 3.0.12

can you print a module? i see some of the dotnetnuke.com modules have a print icon...

dnn behind firewall

new to dnn, am getting sql errors

portal alias, or how to move from localhost to server

how to use flash as a logo or banner

dnn 4

dotnetnuke 4.3.0 upgrade or source ?

moving install confuses passwords

set host banners as default for all sites

install skin -> found

think my database got corrupted...

child portal admin cannot manage -- please help --

upload anything at filemanager >> dnn2

rewriterrule starter question

dnn4 firewall issues

urgent cant see the module setting tab on logging as host/admin

dotnetnuke navigation

cannot install modules?

adding a new portal

quick questions (hopefully)

using dotnetnuke 3.1.1

export to a cd rom

having problem in applying and uploading skin

dotnetnuke 3.1.1 installation

ugrade from 2.1.2 to 3.1 --- help!

  Privacy | Contact Us
All Times Are GMT