Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 18th, 2005, 03:41 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default Controls

Greetings all.

I am working on an application that displays a grid with dropdownboxs in various parts of this grid. Now the entire gird is generated dynamically based on user interaction, so i have put the code required to generate this grid in an .ascx file. Here is my problem:

My grid is generating perfectly, but I am stuck on this on part: I currently have the functionality that is the user changes an item in any of the dropdowns, the form will postback to itself, however, i am unable to get the selectedIndex.Text or Value.

first let me share with you how i create the drop downboxes:
Code:
                            hwriter.WriteBeginTag("select")
                            hwriter.WriteAttribute("name", i.ToString)
                            hwriter.WriteAttribute("OnChange", "javascript: " & Page.GetPostBackEventReference(Me, Me.UniqueID))
                            hwriter.Write(HtmlTextWriter.TagRightChar)
                            hwriter.WriteBeginTag("option")
                            hwriter.WriteAttribute("value", "ins~" & intUsers(i).ToString & "~" & intLinkId.ToString & "~" & dt.Rows(x).Item("roleValue"))
                            hwriter.WriteAttribute("selected", "selected")
                            hwriter.Write(HtmlTextWriter.TagRightChar)
                            hwriter.Write(dt.Rows(x).Item("name"))
                            hwriter.WriteEndTag("option")

The way the above code is laid out, when a postback occurs, my eventArgs is the value of: 'Me.UniqueID' which does me no good. I have looked through my VS.Net help files and there are examples on how to do this with button and raising the click event, I can not duplicate this for the onChange event??? Any help as to how I can get the values of the selected item would be greatly appreciated.
-Doug

"The one language all programmers understand is profanity."
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================
Reply With Quote
  #2 (permalink)  
Old October 19th, 2005, 11:08 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Follow-up:
While I don't think that this is the "best" way to accomplish this I have found somewhat of a work around to solve my problem at hand.

Using the supplied code as a reference,
I changed the
Code:
Page.GetPostBackEventReference(Me, Me.UniqueID))
to
Code:
Page.GetPostBackEventReference(Me, i.toString))
when a user changes the value of a dropdown the method:

Code:
Public Sub RaisePostBackEvent(ByVal eventArgument As String) Implements System.Web.UI.IPostBackEventHandler.RaisePostBackEvent
And the name of the dropdownbox is passed in as an argument. From here I call a method that excepts a string as a parameter (the dropdown ID) and then use the
Code:
Request('dropdownID')
to get the values that are sent via postback.

So that is one possible solution, though if anyone has any input or thoughts that are greatly appreciated!

is called.

"The one language all programmers understand is profanity."
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User controls' content: Chapter 2 User Controls AGS BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 10 July 26th, 2007 05:36 AM
Retain the value of Controls S_Dogra ASP.NET 1.0 and 1.1 Professional 1 January 31st, 2007 01:21 PM
Binding controls Boris Kofman VB Databases Basics 1 January 20th, 2007 01:16 PM
Using controls AllenJ .NET Framework 2.0 1 July 31st, 2006 05:01 AM
Controls Natalie Beginning VB 6 6 September 12th, 2003 10:27 AM



All times are GMT -4. The time now is 09:54 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.