0

hello, I am a beginner in ASP.NET and I really need your help.

I have a simple database, I want to show list of names (customers) in a dropdown list and, according to what I click on the dropdown list, to get the table updated below... with data corresponding to dropdown list selection.

I know there is GridView, and I know everything can be done automatically, but I want to learn coding and I want to do it myself... coz when I do it automatically it doesnt show any code so I can ponder on it and learn.

Please help
thanks

3
Contributors
4
Replies
8
Views
5 Years
Discussion Span
Last Post by azapovjednik
0

ok, so what exactly is the question? I understand what you're wanting to accomplish, but where are you in the process? What have you tried so far? What are your results compared to what you expect? Are you getting any errors?

Edited by nakor77

0

thanks for reply.
I already made one dropdown list which is pulling list of customers. It is ok. here is the code of that:

`protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["konekcija"].ToString());
        SqlCommand cmd = new SqlCommand("SELECT ID, CustomerName+' '+CustomerSurname as Customer FROM tblCustomers",conn);

        conn.Open();
        SqlDataReader dr = cmd.ExecuteReader();
        drp.DataSource = dr;
        drp.DataTextField = "Customer";
        drp.DataValueField = "ID";
        drp.DataBind();
        conn.Close();

    }

Now, what I want to do is to make a table showing data relative to what I select in dropdown list.
So if I change, if I select something else in the dropdown list, the table also changes the data to show the data related to the customer selected in the dropdown list.

The easiest way to accomplish this is to do it automatically. But I would like to do it by myself...
How do I do it? I need some advices.

Thanks

0

Several ways you can do this...one is that enable the dropdownlist to autopost back. On a page load which is a post back you can check to see what has been selected and then do something based on that information.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.