Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 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 Display Modes
  #1 (permalink)  
Old December 7th, 2005, 10:44 AM
Registered User
 
Join Date: Dec 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Populating web form with drop down list selection

Okay, I'm really new to this and am not sure how to get this to work, so here goes. I have a web form, User Administration. It contains a "search" button, which allows the user to search by first name or last name or both when clicked, depending on what the user has entered...it then populates the form with first name, last name, location, hardware & software for everyone that falls within the criteria. I've included the code below; however, I also have a databound location list box, which holds 42 of our stores. I can't figure out how to get a list of users at a specific location, if the location (no first or last name) is the only selected item prior to hitting the "search" button...I hope this makes sense and thanks in advance for any help you can give me.

 Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
        Fname = Trim(txtFnameAdd.Text)
        Lname = Trim(txtLnameAdd.Text)

        sql = "SELECT key_id, Fname, Lname, location, LEFT(Datemodified,11) as DateModified,"
        sql = sql & "'<a href='"
        sql = sql + "'Inventory Assign Hardware.aspx?ID='"
        sql = sql & " + Cast(key_ID as Char) + "
        sql = sql & "'''>Hardware Permissions"
        sql = sql & "</a>' as Hardware,"
        sql = sql & "'<a href='"
        sql = sql + "'Inventory Assign Software.aspx?ID='"
        sql = sql & " + Cast(key_ID as Char) + "
        sql = sql & "'''>Software Permissions"
        sql = sql & "</a>' as Software from Users "

        If txtFnameAdd.Text <> "" And txtLnameAdd.Text = "" Then sql = sql & " WHERE Fname like '%' + '" & Fname & "' + '%'"
        If txtLnameAdd.Text <> "" And txtFnameAdd.Text = "" Then sql = sql & " WHERE Lname like '%' + '" & Lname & "' + '%'"
        sql = sql & BuildQuery()
        daUsers = New System.Data.SqlClient.SqlDataAdapter(sql, SORCInventory)
        daUsers.Fill(dsUser)
        dgUsers.DataSource = dsUser
        dgUsers.DataBind()
    End Sub

    Function GetLocations() As DataSet

        Dim ddlDataSet As DataSet = New DataSet
        Const strSQLDDL As String = _
             "SELECT location FROM location ORDER BY location"

        Dim myDataAdapter As SqlDataAdapter = New _
                              SqlDataAdapter(strSQLDDL, SORCInventory)

        myDataAdapter.Fill(ddlDataSet, "Location")

        Return ddlDataSet
    End Function

Reply With Quote
Reply


Thread Tools
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
Populating a drop down list from an ArrayList snejsnej ASP.NET 1.0 and 1.1 Basics 1 April 20th, 2006 11:14 AM
Java script function on drop down list selection Sachin3k Javascript How-To 3 April 30th, 2005 11:30 AM
populating a drop down with a file list cjcd ASP.NET 1.0 and 1.1 Professional 2 April 18th, 2004 10:37 AM
populating a drop down with a file list cjcd BOOK: Beginning ASP.NET 1.0 1 April 17th, 2004 02:53 AM



All times are GMT -4. The time now is 12:02 PM.


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