473,888 Members | 1,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Populating and Implementing 4 DropDownlist boxes on the Web Form through Web Service

34 New Member
Hi all,

I have a Project due after one week. It is a web service project. I have a Web Form which communicates to the web service and this web service communicates to the database. I have all my SQL statements in the Data Acess Layer to create more secure web service application. The Web service class is also in the Data Access Layer. I need to populates the 4 Dropdown list boxes on the web form from one table. I have Customer table which contains information About CustomerName, CustomerType, Address, City. These 4 colum values should populate the 4 Dropdown lists. And then I need to implement those 4 dropdowns like this. When the user selects a Customername it should display relevant customer information in the GridView. Or when the user selects values from all 4 listboxes it should display all information on GridView as well.

For all the above I have just populated one listbox but I don't know how to populate the other 3 dropdown lists and implement them on the web form.

I have created one method in the Data Access Layer class and one method in the Web Service class and then I instaitiated the web service object in the web form by adding a web reference. It works fine for just populating one dropdown list box but for the whole 4 dropdown list I am unable to populated and Implement them.

Below are the methods and the code for one dropdownlist.



(1)Web Form code:


WebService.Serv ice ws = new WebService.Serv ice();

protected void Page_Load(objec t sender, EventArgs e)
{


object[] alist;
alist = ws.GetBusinessT ype(string.Empt y);
DropDownList1.D ataSource = alist;
DropDownList1.D ataBind();



(2) Web Service Method:


[WebMethod]
public ArrayList GetBusinessType (string btype)
{
DAccess ODA = new DAccess(); //Data Access object
ArrayList list = new ArrayList();

list = ODA.GetBusiness Type(btype); //Data Access method

return list;

}


(3) Data Access method:

public ArrayList GetBusinessType (string btype)
{
SqlConnection connection = GetConnection;
try
{
ArrayList arrbt = new ArrayList();


StringBuilder sql = new StringBuilder()
.AppendLine("SE LECT")
.AppendLine("\t TYPENAME")
.AppendLine("\t FROM")
.AppendLine("\t BUSINESS_TYPE") ;

SqlParameter paramTYPENAME = new SqlParameter("T YPENAME", SqlDbType.NVarC har);
paramTYPENAME.V alue = btype;

connection.Open ();

SqlDataReader reader = ExecuteQuery(co nnection, sql.ToString(), paramTYPENAME);

while (reader.Read())
{
string result = reader["TYPENAME"].ToString();
arrbt.Add(resul t);

}

return arrbt;
}
catch (Exception ex)
{
return null;
//do some log here Call a class that logs the errors
}
finally
{
connection.Clos e();
}


All the above code works fine for just populating the one dropdown list but not implementing. I just want the implementation something like....When the user select one dropdown or all of them then it should display the result in the gridview. I have not shown the aspx code here but the main thing is the code above. Can any one help me to implement this

I really appreciate your help. Looking forward to your reply.

Thanks

Koonda
Apr 15 '07 #1
0 1711

Sign in to post your reply or Sign up for a free account.

Similar topics

7
4110
by: Drew | last post by:
I have a db table like the following, UID, int auto-increment RegNo Person Relation YearsKnown Now here is some sample data from this table,
3
1732
by: Bill | last post by:
I have a seating chart web form that has over 50 entry field controls (tables/booths) where I use a DropDownList box to select a single company name from a single large list of organizations (200 plus conference attendees). All web form datavalues will be one of the same 200 organizations in this list. I would like to avoid creating 50 separate exact copies of the same DataSet object. Can you help? Q. Exactly how do I use the same...
3
1549
by: jayfischer91 | last post by:
The method below belongs to a class. The method accepts a dropdownlist as a parameter. Is there any disadvantage to passing in the control and having this method populate it as opposed to passing back a datareader from this method and having the webform populate it? It seems to work great! Just wondering if there may be a disadvantage to passing a control. Oh yea, by the way, it is just passing a pointer to the control, right? Or...
1
20648
by: Darrylw99 | last post by:
Hi Folks I've been dumped in at the deepend and need to understand the answer pretty quickly. I've got a dropdownlist and need to use Microsoft Data Access Blocks; so implementing a Dataset, how do I populate the list with the contents from a table called Parameters. Also does anyone know of a very good site that will explain C# to me in the least amount of time? Cheers in advance.
2
1101
by: wcaruso | last post by:
Good afternoon. I'm in the midst of writing up a pretty "basic" web form and having some difficulties. I'm completely open for suggestions. I'm using VS.net 2003, and what iwould like to accomplish is to have a form with two dropdown Boxes a button and a datagrid to display what was selected from the drop downs. One of the drop downs values can not be used more than once while the others can be repeated as often as they like. Being...
3
2654
by: RFS666 | last post by:
Hello together, I tried to find out about populating an asp.net server control (a dropdownlist) from the clientside jscript, but I didn't find a solution up to now. I cannot use a html dropdownlist, because a database query in codebehind has to be done, when a new listItem is selected. So, I need to use a servercontrol dropdownlist. Now to my problem:
6
1484
by: needin4mation | last post by:
I have a gridview and a dropdownlist. If I change the ddl, the gridview populates. That is what I want. But what I don't want is for it to happen the first time they get to the page. I know I can add a "Select Item," but is that the correct way to do it? I don't want it to hit the database at all the first time the page loads. I have done everything through visual studio and was trying to see if I could do this with no code behind. ...
2
3278
by: Dave | last post by:
I have 3 tables of information feeding into 4 combo boxes on my main form (DR Form). I have as many list boxes (acting as text boxes) as there are fields in each one of the 3 tables. Once selecting from the combo box, I have all the combo boxes, using afterupdate, populating their respective list boxes. These text boxes are directly correlated to the combo box selection using SQL. Here is an example from the afterupdate event in the...
1
1397
by: sweatha | last post by:
Hi Friends I have designed a form with 1 DropDownList box named “ddlShow_time”& the form name is “Default4.aspx”. Just like that, I have the database(SQL SERVER 2000) as Table Name: ShowTime ----------------------------------------------------------------------------- Theater_Name ShowTime Movie_Name ------------------------------------------------------------------------------- Udhayam 10:00am ...
0
9961
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9800
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10438
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9597
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7990
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7148
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5817
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6014
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4642
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.