Dropdownlist prepopulation

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Dropdownlist prepopulation

    I am trying to prepopulate two drop down meus with results of two differnt
    SQL queries. I have written the following code. But I am getting errors. Can
    anybody please help me how to do this. I also doubt whether this is the most
    efficient way to have maximum performance when lots of users access the web
    site.

    string dsn = ConfigurationSettings.AppSettings["testDsn"];
    SqlConnection connection = new SqlConnection (dsn);
    SqlDataAdapter adapter = new SqlDataAdapter ("select * from authors; select
    * from publishers", connection);
    DataSet ds = new DataSet ();
    adapter.Fill (ds, "authors");

    DropDownList1.DataSource = ds;
    DropDownList1.DataTextField = "au_fname";
    DropDownList1.DataValueField = "au_id";
    DropDownList1.DataBind ();
    DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf
    (DropDownList1.Items.FindByValue ("672-71-3249"));

    DataSet ds2 = new DataSet ();
    adapter.Fill (ds2, "publishers");
    DropDownList2.DataSource = ds2;
    DropDownList2.DataTextField = "pub_name";
    DropDownList2.DataValueField = "pub_id";
    DropDownList2.DataBind ();
    DropDownList2.SelectedIndex = DropDownList2.Items.IndexOf
    (DropDownList2.Items.FindByValue ("1389"));



    Thanks,

    Reddy


    Reddy Guest

  2. Similar Questions and Discussions

    1. DropDownList
      Hi I looked everywhere to solve my problem but with no success. On page there is a dropdownlist control which is binded to a database. When I...
    2. Dropdownlist help please
      Hi there, I'm a newbie to Dreamweaver MX 2004 and ASP.NET. I'm having trouble with a simple application that involves the user selecting a value...
    3. Add a dropDownList
      Hello, Could you please give me an exemple how to add a dropdownlist in a datagrid. With this following code, I bind a datatable to a datagrid,...
    4. HELP with ASP.NET DropDownList Box ! : )
      Hi all, I have a DropDownList on my page created in Design Time calledddlDate. In code, I do the following: 1 ddlDate = New DropDownList() <-...
    5. <asp:DropDownList >
      It just doesn't work like that - - you need to either bind data to the datalist in code, or manually add the items, one by one, where you're doing...
  3. #2

    Default Re: Dropdownlist prepopulation

    Reddy,

    Your query is returning both recordsets at the same time, but in your code I
    don't see where you are moving to the second recordset before binding it to
    the second drop down.

    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    [url]www.aboutfortunate.com[/url]

    "Out of chaos comes order."
    Nietzche


    "Reddy" <gksreddy@adsgroup.com> wrote in message
    news:uRwxisNXDHA.1004@TK2MSFTNGP12.phx.gbl...
    > I am trying to prepopulate two drop down meus with results of two differnt
    > SQL queries. I have written the following code. But I am getting errors.
    Can
    > anybody please help me how to do this. I also doubt whether this is the
    most
    > efficient way to have maximum performance when lots of users access the
    web
    > site.
    >
    > string dsn = ConfigurationSettings.AppSettings["testDsn"];
    > SqlConnection connection = new SqlConnection (dsn);
    > SqlDataAdapter adapter = new SqlDataAdapter ("select * from authors;
    select
    > * from publishers", connection);
    > DataSet ds = new DataSet ();
    > adapter.Fill (ds, "authors");
    >
    > DropDownList1.DataSource = ds;
    > DropDownList1.DataTextField = "au_fname";
    > DropDownList1.DataValueField = "au_id";
    > DropDownList1.DataBind ();
    > DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf
    > (DropDownList1.Items.FindByValue ("672-71-3249"));
    >
    > DataSet ds2 = new DataSet ();
    > adapter.Fill (ds2, "publishers");
    > DropDownList2.DataSource = ds2;
    > DropDownList2.DataTextField = "pub_name";
    > DropDownList2.DataValueField = "pub_id";
    > DropDownList2.DataBind ();
    > DropDownList2.SelectedIndex = DropDownList2.Items.IndexOf
    > (DropDownList2.Items.FindByValue ("1389"));
    >
    >
    >
    > Thanks,
    >
    > Reddy
    >
    >

    S. Justin Gengo Guest

  4. #3

    Default Re: Dropdownlist prepopulation

    Sorry I couldn't put it much better.

    I needed to execute two SQL queries and my idea was to get two tables from
    two sql queries.

    I don't know whether I can execute SQL queries like this or need to execute
    them separately

    Reddy


    "S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
    news:%23tX1EiOXDHA.2484@TK2MSFTNGP09.phx.gbl...
    > Reddy,
    >
    > Your query is returning both recordsets at the same time, but in your code
    I
    > don't see where you are moving to the second recordset before binding it
    to
    > the second drop down.
    >
    > Sincerely,
    >
    > --
    > S. Justin Gengo, MCP
    > Web Developer
    >
    > Free code library at:
    > [url]www.aboutfortunate.com[/url]
    >
    > "Out of chaos comes order."
    > Nietzche
    >
    >
    > "Reddy" <gksreddy@adsgroup.com> wrote in message
    > news:uRwxisNXDHA.1004@TK2MSFTNGP12.phx.gbl...
    > > I am trying to prepopulate two drop down meus with results of two
    differnt
    > > SQL queries. I have written the following code. But I am getting errors.
    > Can
    > > anybody please help me how to do this. I also doubt whether this is the
    > most
    > > efficient way to have maximum performance when lots of users access the
    > web
    > > site.
    > >
    > > string dsn = ConfigurationSettings.AppSettings["testDsn"];
    > > SqlConnection connection = new SqlConnection (dsn);
    > > SqlDataAdapter adapter = new SqlDataAdapter ("select * from authors;
    > select
    > > * from publishers", connection);
    > > DataSet ds = new DataSet ();
    > > adapter.Fill (ds, "authors");
    > >
    > > DropDownList1.DataSource = ds;
    > > DropDownList1.DataTextField = "au_fname";
    > > DropDownList1.DataValueField = "au_id";
    > > DropDownList1.DataBind ();
    > > DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf
    > > (DropDownList1.Items.FindByValue ("672-71-3249"));
    > >
    > > DataSet ds2 = new DataSet ();
    > > adapter.Fill (ds2, "publishers");
    > > DropDownList2.DataSource = ds2;
    > > DropDownList2.DataTextField = "pub_name";
    > > DropDownList2.DataValueField = "pub_id";
    > > DropDownList2.DataBind ();
    > > DropDownList2.SelectedIndex = DropDownList2.Items.IndexOf
    > > (DropDownList2.Items.FindByValue ("1389"));
    > >
    > >
    > >
    > > Thanks,
    > >
    > > Reddy
    > >
    > >
    >
    >

    Reddy Guest

  5. #4

    Default Re: Dropdownlist prepopulation

    You should write as following:
    ----------------------------------

    public DataTable GetDataTable(string sql){
    string dsn = ConfigurationSettings.AppSettings["testDsn"];
    SqlConnection connection = new SqlConnection (dsn);
    SqlDataAdapter adapter = new SqlDataAdapter (sql, connection);
    DataSet ds = new DataSet ();
    adapter.Fill (ds);
    return ds.Tables[0];
    }

    public void Page_Load()
    {
    if(!IsPostBack)
    {
    DropDownList1.DataSource = GetDataTable("select * from authors");
    DropDownList1.DataTextField = "au_fname";
    DropDownList1.DataValueField = "au_id";
    DropDownList1.DataBind ();
    DropDownList1.Items.FindByValue ("672-71-3249").Selected = true;

    DropDownList2.DataSource = GetDataTable("select * from publishers");
    DropDownList2.DataTextField = "pub_name";
    DropDownList2.DataValueField = "pub_id";
    DropDownList2.DataBind ();
    DropDownList2.Items.FindByValue ("1389").Selected = true;
    }
    }

    "Reddy" <gksreddy@adsgroup.com> wrote in message
    news:uRwxisNXDHA.1004@TK2MSFTNGP12.phx.gbl...
    > I am trying to prepopulate two drop down meus with results of two differnt
    > SQL queries. I have written the following code. But I am getting errors.
    Can
    > anybody please help me how to do this. I also doubt whether this is the
    most
    > efficient way to have maximum performance when lots of users access the
    web
    > site.
    >
    > string dsn = ConfigurationSettings.AppSettings["testDsn"];
    > SqlConnection connection = new SqlConnection (dsn);
    > SqlDataAdapter adapter = new SqlDataAdapter ("select * from authors;
    select
    > * from publishers", connection);
    > DataSet ds = new DataSet ();
    > adapter.Fill (ds, "authors");
    >
    > DropDownList1.DataSource = ds;
    > DropDownList1.DataTextField = "au_fname";
    > DropDownList1.DataValueField = "au_id";
    > DropDownList1.DataBind ();
    > DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf
    > (DropDownList1.Items.FindByValue ("672-71-3249"));
    >
    > DataSet ds2 = new DataSet ();
    > adapter.Fill (ds2, "publishers");
    > DropDownList2.DataSource = ds2;
    > DropDownList2.DataTextField = "pub_name";
    > DropDownList2.DataValueField = "pub_id";
    > DropDownList2.DataBind ();
    > DropDownList2.SelectedIndex = DropDownList2.Items.IndexOf
    > (DropDownList2.Items.FindByValue ("1389"));
    >
    >
    >
    > Thanks,
    >
    > Reddy
    >
    >

    Bülent Keskin Guest

  6. #5

    Default Re: Dropdownlist prepopulation

    Reddy,

    You can certainly do it this way.

    Just specify the datamember (the table name) for each drop down list as Jeff
    says.

    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    [url]www.aboutfortunate.com[/url]

    "Out of chaos comes order."
    Nietzche


    "Reddy" <gksreddy@adsgroup.com> wrote in message
    news:OkX32wOXDHA.2632@TK2MSFTNGP09.phx.gbl...
    > Sorry I couldn't put it much better.
    >
    > I needed to execute two SQL queries and my idea was to get two tables from
    > two sql queries.
    >
    > I don't know whether I can execute SQL queries like this or need to
    execute
    > them separately
    >
    > Reddy
    >
    >
    > "S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
    > news:%23tX1EiOXDHA.2484@TK2MSFTNGP09.phx.gbl...
    > > Reddy,
    > >
    > > Your query is returning both recordsets at the same time, but in your
    code
    > I
    > > don't see where you are moving to the second recordset before binding it
    > to
    > > the second drop down.
    > >
    > > Sincerely,
    > >
    > > --
    > > S. Justin Gengo, MCP
    > > Web Developer
    > >
    > > Free code library at:
    > > [url]www.aboutfortunate.com[/url]
    > >
    > > "Out of chaos comes order."
    > > Nietzche
    > >
    > >
    > > "Reddy" <gksreddy@adsgroup.com> wrote in message
    > > news:uRwxisNXDHA.1004@TK2MSFTNGP12.phx.gbl...
    > > > I am trying to prepopulate two drop down meus with results of two
    > differnt
    > > > SQL queries. I have written the following code. But I am getting
    errors.
    > > Can
    > > > anybody please help me how to do this. I also doubt whether this is
    the
    > > most
    > > > efficient way to have maximum performance when lots of users access
    the
    > > web
    > > > site.
    > > >
    > > > string dsn = ConfigurationSettings.AppSettings["testDsn"];
    > > > SqlConnection connection = new SqlConnection (dsn);
    > > > SqlDataAdapter adapter = new SqlDataAdapter ("select * from authors;
    > > select
    > > > * from publishers", connection);
    > > > DataSet ds = new DataSet ();
    > > > adapter.Fill (ds, "authors");
    > > >
    > > > DropDownList1.DataSource = ds;
    > > > DropDownList1.DataTextField = "au_fname";
    > > > DropDownList1.DataValueField = "au_id";
    > > > DropDownList1.DataBind ();
    > > > DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf
    > > > (DropDownList1.Items.FindByValue ("672-71-3249"));
    > > >
    > > > DataSet ds2 = new DataSet ();
    > > > adapter.Fill (ds2, "publishers");
    > > > DropDownList2.DataSource = ds2;
    > > > DropDownList2.DataTextField = "pub_name";
    > > > DropDownList2.DataValueField = "pub_id";
    > > > DropDownList2.DataBind ();
    > > > DropDownList2.SelectedIndex = DropDownList2.Items.IndexOf
    > > > (DropDownList2.Items.FindByValue ("1389"));
    > > >
    > > >
    > > >
    > > > Thanks,
    > > >
    > > > Reddy
    > > >
    > > >
    > >
    > >
    >
    >

    S. Justin Gengo Guest

  7. #6

    Default Re: Dropdownlist prepopulation

    Reddy,

    I was just experimenting with some code similar to yours and I noticed that
    the tables aren't named. Here's what you need to do:

    1) The way you are creating your connection and filling your first dataset
    is just fine. The dataset is actually being populated with two tables each
    based on one of the two select statements you are using in the SqlCommand.

    2) You won't need the second dataset at all.

    3) The tables do not have string names. You'll need to refer to them by
    index number.

    4) When you assign a datatable to the datalist, quick way to specify the
    correct datasource would be to specify the correct datatable directly:

    DropDownList1.DataSource = ds.Tables(0);

    DropDownList2.DataSource = ds.Tables(1);

    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    [url]www.aboutfortunate.com[/url]

    "Out of chaos comes order."
    Nietzche


    "S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
    news:%23tX1EiOXDHA.2484@TK2MSFTNGP09.phx.gbl...
    > Reddy,
    >
    > Your query is returning both recordsets at the same time, but in your code
    I
    > don't see where you are moving to the second recordset before binding it
    to
    > the second drop down.
    >
    > Sincerely,
    >
    > --
    > S. Justin Gengo, MCP
    > Web Developer
    >
    > Free code library at:
    > [url]www.aboutfortunate.com[/url]
    >
    > "Out of chaos comes order."
    > Nietzche
    >
    >
    > "Reddy" <gksreddy@adsgroup.com> wrote in message
    > news:uRwxisNXDHA.1004@TK2MSFTNGP12.phx.gbl...
    > > I am trying to prepopulate two drop down meus with results of two
    differnt
    > > SQL queries. I have written the following code. But I am getting errors.
    > Can
    > > anybody please help me how to do this. I also doubt whether this is the
    > most
    > > efficient way to have maximum performance when lots of users access the
    > web
    > > site.
    > >
    > > string dsn = ConfigurationSettings.AppSettings["testDsn"];
    > > SqlConnection connection = new SqlConnection (dsn);
    > > SqlDataAdapter adapter = new SqlDataAdapter ("select * from authors;
    > select
    > > * from publishers", connection);
    > > DataSet ds = new DataSet ();
    > > adapter.Fill (ds, "authors");
    > >
    > > DropDownList1.DataSource = ds;
    > > DropDownList1.DataTextField = "au_fname";
    > > DropDownList1.DataValueField = "au_id";
    > > DropDownList1.DataBind ();
    > > DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf
    > > (DropDownList1.Items.FindByValue ("672-71-3249"));
    > >
    > > DataSet ds2 = new DataSet ();
    > > adapter.Fill (ds2, "publishers");
    > > DropDownList2.DataSource = ds2;
    > > DropDownList2.DataTextField = "pub_name";
    > > DropDownList2.DataValueField = "pub_id";
    > > DropDownList2.DataBind ();
    > > DropDownList2.SelectedIndex = DropDownList2.Items.IndexOf
    > > (DropDownList2.Items.FindByValue ("1389"));
    > >
    > >
    > >
    > > Thanks,
    > >
    > > Reddy
    > >
    > >
    >
    >

    S. Justin Gengo Guest

  8. #7

    Default Re: Dropdownlist prepopulation

    Reddy,

    Ok, I've switched from coffee to mountain dew and my brain is functioning
    better. I realized I gave you bad code here.

    You need to eliminate "authors" from your fill command if you populate the
    datasets the way I suggested.

    Change it from this:

    adapter.Fill (ds, "authors");

    to this:

    adapter.Fill(ds);

    Sorry about that!

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    [url]www.aboutfortunate.com[/url]

    "Out of chaos comes order."
    Nietzche


    "S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
    news:uBA84tPXDHA.2648@TK2MSFTNGP09.phx.gbl...
    > Reddy,
    >
    > I was just experimenting with some code similar to yours and I noticed
    that
    > the tables aren't named. Here's what you need to do:
    >
    > 1) The way you are creating your connection and filling your first dataset
    > is just fine. The dataset is actually being populated with two tables each
    > based on one of the two select statements you are using in the SqlCommand.
    >
    > 2) You won't need the second dataset at all.
    >
    > 3) The tables do not have string names. You'll need to refer to them by
    > index number.
    >
    > 4) When you assign a datatable to the datalist, quick way to specify the
    > correct datasource would be to specify the correct datatable directly:
    >
    > DropDownList1.DataSource = ds.Tables(0);
    >
    > DropDownList2.DataSource = ds.Tables(1);
    >
    > Sincerely,
    >
    > --
    > S. Justin Gengo, MCP
    > Web Developer
    >
    > Free code library at:
    > [url]www.aboutfortunate.com[/url]
    >
    > "Out of chaos comes order."
    > Nietzche
    >
    >
    > "S. Justin Gengo" <sjgengo@aboutfortunate.com> wrote in message
    > news:%23tX1EiOXDHA.2484@TK2MSFTNGP09.phx.gbl...
    > > Reddy,
    > >
    > > Your query is returning both recordsets at the same time, but in your
    code
    > I
    > > don't see where you are moving to the second recordset before binding it
    > to
    > > the second drop down.
    > >
    > > Sincerely,
    > >
    > > --
    > > S. Justin Gengo, MCP
    > > Web Developer
    > >
    > > Free code library at:
    > > [url]www.aboutfortunate.com[/url]
    > >
    > > "Out of chaos comes order."
    > > Nietzche
    > >
    > >
    > > "Reddy" <gksreddy@adsgroup.com> wrote in message
    > > news:uRwxisNXDHA.1004@TK2MSFTNGP12.phx.gbl...
    > > > I am trying to prepopulate two drop down meus with results of two
    > differnt
    > > > SQL queries. I have written the following code. But I am getting
    errors.
    > > Can
    > > > anybody please help me how to do this. I also doubt whether this is
    the
    > > most
    > > > efficient way to have maximum performance when lots of users access
    the
    > > web
    > > > site.
    > > >
    > > > string dsn = ConfigurationSettings.AppSettings["testDsn"];
    > > > SqlConnection connection = new SqlConnection (dsn);
    > > > SqlDataAdapter adapter = new SqlDataAdapter ("select * from authors;
    > > select
    > > > * from publishers", connection);
    > > > DataSet ds = new DataSet ();
    > > > adapter.Fill (ds, "authors");
    > > >
    > > > DropDownList1.DataSource = ds;
    > > > DropDownList1.DataTextField = "au_fname";
    > > > DropDownList1.DataValueField = "au_id";
    > > > DropDownList1.DataBind ();
    > > > DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf
    > > > (DropDownList1.Items.FindByValue ("672-71-3249"));
    > > >
    > > > DataSet ds2 = new DataSet ();
    > > > adapter.Fill (ds2, "publishers");
    > > > DropDownList2.DataSource = ds2;
    > > > DropDownList2.DataTextField = "pub_name";
    > > > DropDownList2.DataValueField = "pub_id";
    > > > DropDownList2.DataBind ();
    > > > DropDownList2.SelectedIndex = DropDownList2.Items.IndexOf
    > > > (DropDownList2.Items.FindByValue ("1389"));
    > > >
    > > >
    > > >
    > > > Thanks,
    > > >
    > > > Reddy
    > > >
    > > >
    > >
    > >
    >
    >

    S. Justin Gengo Guest

  9. #8

    Default Re: Dropdownlist prepopulation

    Reddy,

    The only real way to tell is to try each.

    Put them both in a loop and run it say, 10,000 times. Get the start time
    before the loop and the end time after and see which is faster.

    Please post the results here. I'm sure we're all curious which will be
    faster.

    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    [url]www.aboutfortunate.com[/url]

    "Out of chaos comes order."
    Nietzche


    "Reddy" <gksreddy@adsgroup.com> wrote in message
    news:uYjB6XZXDHA.2516@TK2MSFTNGP09.phx.gbl...
    > Thanks Everyone.
    >
    > Both the processes work fantastically
    >
    > I am in a dilemma now. Which of the two processes is the most efficient
    way
    > performance wise(when more number of users access the same page). Becuase
    I
    > want to use some more controls on the same page.
    >
    >
    > private void Page_Load(object sender, System.EventArgs e)
    > {
    > DropDownList1.DataSource = GetDataTable("select * from authors");
    > DropDownList1.DataTextField = "au_fname";
    > DropDownList1.DataValueField = "au_id";
    > DropDownList1.DataBind ();
    > DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf
    > (DropDownList1.Items.FindByValue ("672-71-3249"));
    >
    > DropDownList2.DataSource = GetDataTable("select * from publishers");
    > DropDownList2.DataTextField = "pub_name";
    > DropDownList2.DataValueField = "pub_id";
    > DropDownList2.DataBind ();
    > DropDownList2.SelectedIndex = DropDownList2.Items.IndexOf
    > (DropDownList2.Items.FindByValue ("1389"));
    > }
    > public DataTable GetDataTable(string sql)
    > {
    > string dsn = ConfigurationSettings.AppSettings["testDsn"];
    > SqlConnection connection = new SqlConnection (dsn);
    > SqlDataAdapter adapter = new SqlDataAdapter (sql, connection);
    > DataSet ds = new DataSet ();
    > adapter.Fill (ds);
    > return ds.Tables[0];
    > }
    >
    >
    >
    >
    >
    > or
    >
    >
    >
    >
    > private void Page_Load(object sender, System.EventArgs e)
    > {
    > string dsn = ConfigurationSettings.AppSettings["testDsn"];
    > SqlConnection connection = new SqlConnection (dsn);
    > SqlDataAdapter adapter = new SqlDataAdapter ("select * from authors;
    select
    > * from publishers", connection);
    > DataSet ds = new DataSet ();
    > adapter.Fill (ds);
    >
    > DropDownList1.DataSource = ds.Tables[0];
    > DropDownList1.DataTextField = "au_fname";
    > DropDownList1.DataValueField = "au_id";
    > DropDownList1.DataBind ();
    > DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf
    > (DropDownList1.Items.FindByValue ("672-71-3249"));
    >
    > DropDownList2.DataSource = ds.Tables[1];
    > DropDownList2.DataTextField = "pub_name";
    > DropDownList2.DataValueField = "pub_id";
    > DropDownList2.DataBind ();
    > DropDownList2.SelectedIndex = DropDownList2.Items.IndexOf
    > (DropDownList2.Items.FindByValue ("1389"));
    > }
    >
    >
    > Reddy
    >
    >
    >
    >
    >
    > "Reddy" <gksreddy@adsgroup.com> wrote in message
    > news:uRwxisNXDHA.1004@TK2MSFTNGP12.phx.gbl...
    > > I am trying to prepopulate two drop down meus with results of two
    differnt
    > > SQL queries. I have written the following code. But I am getting errors.
    > Can
    > > anybody please help me how to do this. I also doubt whether this is the
    > most
    > > efficient way to have maximum performance when lots of users access the
    > web
    > > site.
    > >
    > > string dsn = ConfigurationSettings.AppSettings["testDsn"];
    > > SqlConnection connection = new SqlConnection (dsn);
    > > SqlDataAdapter adapter = new SqlDataAdapter ("select * from authors;
    > select
    > > * from publishers", connection);
    > > DataSet ds = new DataSet ();
    > > adapter.Fill (ds, "authors");
    > >
    > > DropDownList1.DataSource = ds;
    > > DropDownList1.DataTextField = "au_fname";
    > > DropDownList1.DataValueField = "au_id";
    > > DropDownList1.DataBind ();
    > > DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf
    > > (DropDownList1.Items.FindByValue ("672-71-3249"));
    > >
    > > DataSet ds2 = new DataSet ();
    > > adapter.Fill (ds2, "publishers");
    > > DropDownList2.DataSource = ds2;
    > > DropDownList2.DataTextField = "pub_name";
    > > DropDownList2.DataValueField = "pub_id";
    > > DropDownList2.DataBind ();
    > > DropDownList2.SelectedIndex = DropDownList2.Items.IndexOf
    > > (DropDownList2.Items.FindByValue ("1389"));
    > >
    > >
    > >
    > > Thanks,
    > >
    > > Reddy
    > >
    > >
    >
    >

    S. Justin Gengo Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139