470,594 Members | 1,457 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,594 developers. It's quick & easy.

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

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;

(2) Web Service Method:

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;
ArrayList arrbt = new ArrayList();

StringBuilder sql = new StringBuilder()

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


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

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


return arrbt;
catch (Exception ex)
return null;
//do some log here Call a class that logs the errors

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.


Apr 15 '07 #1
0 1539

Post your reply

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

Similar topics

3 posts views Thread by jayfischer91 | last post: by
1 post views Thread by Darrylw99 | last post: by
2 posts views Thread by wcaruso | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.