473,544 Members | 1,369 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 1677

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

Similar topics

7
4064
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
1719
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...
3
1535
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...
1
20637
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...
2
1087
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...
3
2622
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. ...
6
1465
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...
2
3261
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...
1
1382
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...
0
7774
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7712
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...
0
5914
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...
1
5299
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...
0
3418
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...
0
3412
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1843
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
1
989
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
667
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.