473,394 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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

34
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.Service ws = new WebService.Service();

protected void Page_Load(object sender, EventArgs e)
{


object[] alist;
alist = ws.GetBusinessType(string.Empty);
DropDownList1.DataSource = alist;
DropDownList1.DataBind();



(2) Web Service Method:


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

list = ODA.GetBusinessType(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("SELECT")
.AppendLine("\tTYPENAME")
.AppendLine("\tFROM")
.AppendLine("\tBUSINESS_TYPE");

SqlParameter paramTYPENAME = new SqlParameter("TYPENAME", SqlDbType.NVarChar);
paramTYPENAME.Value = btype;

connection.Open();

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

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

}

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


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 1665

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

Similar topics

7
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
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...
3
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...
1
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...
2
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...
3
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...
6
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...
2
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...
1
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.