setting a dropdownlist using selectindex and get/set

I have put my dropdowns used regularly in usercontrols i now because 
i am editing the page i need to set the dropdownlist to the value of the
departuretravelpoint variable for editing. I know i need to use get and
set and something like the code below in red but i can't find anything
on get and set in my wrox books to help me. I need to get this
working so i can finish the admin system off can you help?

"off to look for the A-Team, Because apparently no one else can help"


## travelpointDD.ascx##

<%@ Inherits="Devotion2Motion.DropDownsComp" Src="../CodeBehind/DropDowns.vb" ClassName="TravelPointDD"%>
<script language="vb" runat="server">

    Sub Page_Load()
        Dim TravelPointDD As New Devotion2Motion.DropDownsComp()
        ' Select the country dropdown list
        dsTravelPointDD.DataSource = TravelPointDD.GetTravelPointDD()

    End Sub

    Public Property Value As Integer
         Return dsTravelPointDD.SelectedItem.Value
        End Get
         dsTravelPointDD.Items.FindByValue(Value).Selected = true
        End Set
    End Property

<asp:DropDownList DataTextField="TravelPoint" DataValueField="TravelPointID" ID="dsTravelPointDD" runat="server"/>

## EditAdminDeals.aspx ##

<UserContol:TravelPointDD Value='<%# DataBinder.Eval(Container.DataItem,"departuretravelpoint") %>' runat="server"/>

9/16/2005 1:11:29 PM 93655 articles. 6 followers. Follow

4 Replies

Similar Articles

[PageSpeed] 19

Never fear, fuzz!

Here you go:  an example straight from the source code of EasyListBox Smile [:)]

    Public Property SelectQuery() As String
            Return _selectQuery
        End Get
        Set(ByVal Value As String)
            _selectQuery = Value
        End Set
    End Property

There are more attributes than that, but this should get you started.  Basically, the idea is that you store the value in a local (private) variable...although that's not required.  Also, the return value has to be consistent with the property type (e.g. you can't return a string for an integer property).


Peter Brunone
Do the impossible, and go home early.
9/16/2005 3:15:01 PM
but my value is't getting drawn from the db its coming from the aspx page?

9/19/2005 9:10:44 AM
Could you use:

    Public Property Index As Integer
             Return dsTravelPointDD.SelectedIndex
        End Get
             dsTravelPointDD.SelectedIndex = yourintegervariable
        End Set
    End Property

My Blog
9/19/2005 10:32:31 AM
yeah but it seems my value for the aspx page isn't getting called in 
and i can't work out why?


9/19/2005 1:05:12 PM

Similar Artilces:

Getting the Result set of a Web Service in to Data Set Directly.
Guys, Have you ever heard that you can access a XML Web service from your .Net application without adding reference to it or without creating a proxy class for it?. There are still ways to consume a XML Web service directly using HTTP GET method. This method is very interesting and I have found when doing some .Net R&D work. Most of the XML web services are support HTTP GET method. That means you can use HTTP GET method to invoke a XML web service to get an output. A XML Web service will accept parameter(s) and generate a XML based output as a result. EX: http://ws....

superreview requested: [Bug 288906] Return null for MSAA name when no name explicitly set for HTML form control : [Attachment 179538] If no name explictly set for form control, use SetIsVoid(null)
Aaron Leventhal <> has asked <> for superreview: Bug 288906: Return null for MSAA name when no name explicitly set for HTML form control Attachment 179538: If no name explictly set for form control, use SetIsVoid(null) ...

superreview granted: [Bug 288906] Return null for MSAA name when no name explicitly set for HTML form control : [Attachment 179538] If no name explictly set for form control, use SetIsVoid(null) <> has granted Aaron Leventhal <>'s request for superreview: Bug 288906: Return null for MSAA name when no name explicitly set for HTML form control Attachment 179538: If no name explictly set for form control, use SetIsVoid(null) ...

Web.Config and Settings.settings
Say you have a web application that references a class library.  How can you put values in the web.config file so that the settings.Designer.vb file (in the class library) can access them?  I have just cut and pasted the "applicationSettings" section from the app.config of the class library to the web.config of the webApp, but this does not seem to have worked.E.G.  I have a setting "MyTestURL" in the settings.settings file of the class library. This results in an autogenerated property  "MyTestURL" in the corresponding settings.designer file...

getting forms authentication settings from web.config file
I'm trying to programmatically determine the loginUrl defined in my web.config file. When debugging, I can see that: ConfigurationSettings.GetConfig("system.web/authentication") returns an object of type: System.Web.Configuration.AuthenticationConfig However, this class is inaccessible. Anyone know of any other way to get the authentication mode?? You could try using reflection. Alternatively (and probably better), you can load your web.config file into an XmlDocument and get the relevant attribute using an XPath expression. Something like this sho...

C#-WEB How can I get a property to use the set accessor?
I EDITED THE POST, SORRY!it was a problem while I was copying and pasting inside the wsyg Hi! I need to get a property or anyway to set my private variable that is used within the property's accessor. example: public class Fluffers{    public FooBar Foo{        get{            if (pFoo == null)            StaticFunction.Link((pFoo = new FooBar()));            return pFoo;     ...

Problems with Web Reference, Settings.Settings file and Web.Config
Hi all!I have added a Web Service to my application and noticed it added a Settings.Setting file with the url to my Web Service. My question is how to change this value after i compiled the project and are on my web server. As far as i can see the Settinsg file is compiled and is "inside the dll" .. Can't i make the URL for the webservice to be added to the Web.Config instead of the Settings file? Or is there any other solution here that i have missed, im not so familiar with the Settings file .. Br, Ola I actually solved it myself. My Web.Config was missing the section <sectionGrou...

need to set enctype in form tag of the content page
I can't use more than one Form tag how can I make this work???? Thanks,  Newbie   here is my code for the content page: <asp:Content ID="ContentFileUpload" ContentPlaceHolderID="DefaultMasterPageContentPlaceHolder" Runat="Server"> <script src="../ScriptLibrary/FileUpload.js" type="text/javascript"></script><!-- ENCTYPE - in most cases you will not need to use this attribute at all. The default value is "application/x-www-form-urlencoded", which is sufficient for almost any kind of form dat...

How to get new web app to use .NET 2.0 on Win2K server using .NET 1.1 as default framework?
I have .net framework1.1 and 2.0 on our server running win2K. i have existing applications that uses 1.1, i also have a new app that use 2.0.  how can i set my new .NET 2.0 app to point to 2.0 without messing up my existing .NET 1.1 apps? To specify the ASP .Net version fro a web application, do the followingIn IIS Manager select the web application -> Properties -> ASP.Net TabSelect  ASP.Net version you want to use for the applicationRegards,PrashantDont forget to click "Mark as Answer" on the post that helped you. But I am running Win2K...

How do I set a session ID in a web service SOAP header using a .NET proxy?
I have a web service proxy set up in PB 10.5. I need to set a session ID in the SOAP header so the web service can validate subsequent requests for this session. Is this possible? You can't modify the SOAP headers unfortunately. That capability is supposed to be forthcoming in an EBF/Maintenance Release, but I do not now of an specific timeframe. On 20 Apr 2006 13:40:54 -0700, "Libby Engelbret" <> wrote: >I have a web service proxy set up in PB 10.5. I need to set a session ID in >the SOAP header so the web service can val...

Dynamic Web References in Settings.Settings
Greetings, With ASP.Net in the 1.1. framework, I commonly created web site solutions that contained a project for web pages, and a separate assembly project(.dll) for business objects.  The web project would reference in the business object .dll.  The business object project had an app.config file in which I contained a dynamic reference to a web service (typically for database access).  The reference needed to be dynamic, so that I could change the reference for different deployments simply by changing the entry in the config file. In the ...

How we Call settings from this web.config settings
Edited by SomeNewKid. Please post code between <code> and </code> tags. -----------------Web Config---------------------------------------- <?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <section name="yafnet" type="yaf.SectionHandler,yaf" /> </configSections> <yafnet> <connstr>Trusted_Connection=yes;data source=(local);initial catalog=yafnet;timeout=90</connstr> <root>/</root> <language&...

Web.config vs Settings.settings
Fellow .NETers,  Can you tell me what the difference is betweens the Web.config and Settings.settings and when I should use either.  Currently I am only using the Web.config like so <appSettings><add key="SMTPServer" value="xxxx" /> <add key="DealEmailFromDefault" value=""/><add key="SMTPHost" value="xxxx"/><add key="SecurityTeamEmail" value="xxxxx"/>   </appSettings> Then call in my code like so -  ConfigurationManager.AppSettings["SecurityTea...

Using Get and Set...
I have tried to Google this, but "get" and "set" are very common words in english. Basically, I am looking for some sort of basic tutorial or explanation or something that explains what Get and Set actually do. Everytime I come accross them, their purpose seems a bit hard to deduce. When are these used? Why are they used? Any help is appreciated [edited] Get and Setare used in creating propertiesThink of it like this:Get is what you would use to retrieve a property value (sColorVar=Myobject.Color)Set is what you would use to assign a value to a property (MyObject.C...

Web resources about - setting a dropdownlist using selectindex and get/set -

Tag Synonyms - Stack Overflow
Q&A for professional and enthusiast programmers

Accidental entities - what about the UI?
This post is a follow-up to my previous blog post " Accidental entities - you don't need that identity ". In that post, we followed a consultant ...

Flash Builder Plug-in for SAP Netweaver Gateway - Adobe Labs
Search Navigation Labs Home Wiki Home Technologies Alchemy Blueprint Camera Profiles and DNG Profile Editor Cirrus ColdFusion 10 DNG Codec Fireworks ...

Air Astana - Join Now
Thank you for considering membership of Nomad Club – Kazakhstan’s first Frequent Flyer Program. You could soon be on your way to earning free ...

Languages -> C# Articles, Tutorials, Examples: ASP Alliance
.NET,ASP,ASP.NET,SQL,XML,HTML,ADO,ADO.NET,JavaScript,JScript,CSharp,VBScript and VB tutorials from AspAlliance.

Blog - Avisra
Avisra Web Development Home Blog Services Contact The Blog Latest Module Builder: How can we make it better? Sitefinity by Chris on July 2, 2013 ...

Online Booking Tool Support
This Online Booking Tool Support page might help you as you navigate through the process of booking travel through your OBT provided by CWT. ...

@Html and beyond
... ); } return string .Format( “{0}{1}” , me.Member.Name, id); } The Html building methods are quite simple. Building a dropdownlist for a ...

Top Ranked Articles
Top Ranked Articles - Free source code and tutorials for Software developers and Architects.; Updated: 23 Feb 2013

Unit Testing DateTime.Now Without Isolation
public virtual void SeedWithYearsSince(DropDownList list, int year){ for (int index = year; index

Resources last updated: 1/21/2016 1:16:36 PM