Dropdownlist problem

Discussion in 'ASP .Net' started by =?Utf-8?B?Sko=?=, Jan 7, 2005.

  1. Hi,

    I have a dropdownlist box that has a datasource set to a function call. the
    function call returns an arraylist. I moved the dropdown from a datagrid
    template column that I had it in and it worked with no problem. Now just
    being on the page it doesn't call the function call in datasource anymore. I
    have enableviewstate set to true. Any ideas?

    Thanks,

    JJ
     
    =?Utf-8?B?Sko=?=, Jan 7, 2005
    #1
    1. Advertising

  2. "JJ" <> wrote in message
    news:...
    > Hi,
    >
    > I have a dropdownlist box that has a datasource set to a function call.
    > the
    > function call returns an arraylist. I moved the dropdown from a datagrid
    > template column that I had it in and it worked with no problem. Now just
    > being on the page it doesn't call the function call in datasource
    > anymore. I
    > have enableviewstate set to true. Any ideas?


    Take a look at the .aspx page. What does the dropdownlist have for its
    DataSource property?

    John Saunders
     
    John Saunders, Jan 7, 2005
    #2
    1. Advertising

  3. Hi John,

    When I have the dropdownlist control highlighted in its property sheet
    under Datasource I have the function method name. I don't bind the control in
    code-behind. This way worked when I had this control in a datagrid but now
    the datasource method doesn't get called when page gets created.

    JJ



    "John Saunders" wrote:

    > "JJ" <> wrote in message
    > news:...
    > > Hi,
    > >
    > > I have a dropdownlist box that has a datasource set to a function call.
    > > the
    > > function call returns an arraylist. I moved the dropdown from a datagrid
    > > template column that I had it in and it worked with no problem. Now just
    > > being on the page it doesn't call the function call in datasource
    > > anymore. I
    > > have enableviewstate set to true. Any ideas?

    >
    > Take a look at the .aspx page. What does the dropdownlist have for its
    > DataSource property?
    >
    > John Saunders
    >
    >
    >
     
    =?Utf-8?B?Sko=?=, Jan 7, 2005
    #3
  4. "JJ" <> wrote in message
    news:...
    > Hi John,
    >
    > When I have the dropdownlist control highlighted in its property sheet
    > under Datasource I have the function method name. I don't bind the control
    > in
    > code-behind. This way worked when I had this control in a datagrid but now
    > the datasource method doesn't get called when page gets created.


    JJ, I asked you to look at the .aspx file. For instance:

    <asp:DropDownList runat="server" id="ddl" DataSource="<%# myfunction() %>"
    />

    John Saunders


    > "John Saunders" wrote:
    >
    >> "JJ" <> wrote in message
    >> news:...
    >> > Hi,
    >> >
    >> > I have a dropdownlist box that has a datasource set to a function call.
    >> > the
    >> > function call returns an arraylist. I moved the dropdown from a
    >> > datagrid
    >> > template column that I had it in and it worked with no problem. Now
    >> > just
    >> > being on the page it doesn't call the function call in datasource
    >> > anymore. I
    >> > have enableviewstate set to true. Any ideas?

    >>
    >> Take a look at the .aspx page. What does the dropdownlist have for its
    >> DataSource property?
    >>
    >> John Saunders
    >>
    >>
    >>
     
    John Saunders, Jan 7, 2005
    #4
  5. John,

    I did, here is what it looks like :

    <asp:DropDownList id=ddlSite runat="server" Font-Names="Verdana"
    Font-Size="X-Small" Width="128px" ForeColor="Maroon" AutoPostBack="True"
    DataSource="<%# ListSites() %>" DataTextField="SiteName"
    DataValueField="SiteID"></asp:DropDownList>

    JJ

    "John Saunders" wrote:

    > "JJ" <> wrote in message
    > news:...
    > > Hi John,
    > >
    > > When I have the dropdownlist control highlighted in its property sheet
    > > under Datasource I have the function method name. I don't bind the control
    > > in
    > > code-behind. This way worked when I had this control in a datagrid but now
    > > the datasource method doesn't get called when page gets created.

    >
    > JJ, I asked you to look at the .aspx file. For instance:
    >
    > <asp:DropDownList runat="server" id="ddl" DataSource="<%# myfunction() %>"
    > />
    >
    > John Saunders
    >
    >
    > > "John Saunders" wrote:
    > >
    > >> "JJ" <> wrote in message
    > >> news:...
    > >> > Hi,
    > >> >
    > >> > I have a dropdownlist box that has a datasource set to a function call.
    > >> > the
    > >> > function call returns an arraylist. I moved the dropdown from a
    > >> > datagrid
    > >> > template column that I had it in and it worked with no problem. Now
    > >> > just
    > >> > being on the page it doesn't call the function call in datasource
    > >> > anymore. I
    > >> > have enableviewstate set to true. Any ideas?
    > >>
    > >> Take a look at the .aspx page. What does the dropdownlist have for its
    > >> DataSource property?
    > >>
    > >> John Saunders
    > >>
    > >>
    > >>

    >
    >
    >
     
    =?Utf-8?B?Sko=?=, Jan 7, 2005
    #5
  6. "JJ" <> wrote in message
    news:...
    > John,
    >
    > I did, here is what it looks like :
    >
    > <asp:DropDownList id=ddlSite runat="server" Font-Names="Verdana"
    > Font-Size="X-Small" Width="128px" ForeColor="Maroon" AutoPostBack="True"
    > DataSource="<%# ListSites() %>" DataTextField="SiteName"
    > DataValueField="SiteID"></asp:DropDownList>
    >


    Very good. Now, where is ListSites declared, and how is it declared?

    John Saunders
     
    John Saunders, Jan 7, 2005
    #6
  7. It's declared in code behind page as :

    protected SitesCol ListSites()
    {
    return Sites.GetSites(); <- is a data arraylist class.
    }

    JJ

    "John Saunders" wrote:

    > "JJ" <> wrote in message
    > news:...
    > > John,
    > >
    > > I did, here is what it looks like :
    > >
    > > <asp:DropDownList id=ddlSite runat="server" Font-Names="Verdana"
    > > Font-Size="X-Small" Width="128px" ForeColor="Maroon" AutoPostBack="True"
    > > DataSource="<%# ListSites() %>" DataTextField="SiteName"
    > > DataValueField="SiteID"></asp:DropDownList>
    > >

    >
    > Very good. Now, where is ListSites declared, and how is it declared?
    >
    > John Saunders
    >
    >
    >
     
    =?Utf-8?B?Sko=?=, Jan 7, 2005
    #7
  8. "JJ" <> wrote in message
    news:...
    > It's declared in code behind page as :
    >
    > protected SitesCol ListSites()
    > {
    > return Sites.GetSites(); <- is a data arraylist class.
    > }


    Sorry, my mistake. If the page is compiling, then the method must clearly be
    accessible.

    I don't see any reason why this wouldn't work. It should either give a
    compile error, or else it should call the method. If I were you, I'd make
    certain that it does n ot call the method. For instance, insert a "throw new
    Exception();" before the return statement.

    > "John Saunders" wrote:
    >
    >> "JJ" <> wrote in message
    >> news:...
    >> > John,
    >> >
    >> > I did, here is what it looks like :
    >> >
    >> > <asp:DropDownList id=ddlSite runat="server" Font-Names="Verdana"
    >> > Font-Size="X-Small" Width="128px" ForeColor="Maroon"
    >> > AutoPostBack="True"
    >> > DataSource="<%# ListSites() %>" DataTextField="SiteName"
    >> > DataValueField="SiteID"></asp:DropDownList>
    >> >

    >>
    >> Very good. Now, where is ListSites declared, and how is it declared?
    >>
    >> John Saunders
    >>
    >>
    >>
     
    John Saunders, Jan 7, 2005
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mr2_93
    Replies:
    1
    Views:
    3,625
    mr2_93
    Oct 2, 2005
  2. tshad
    Replies:
    8
    Views:
    2,244
    tshad
    Oct 19, 2005
  3. =?Utf-8?B?SnVhbmpv?=

    GridView: Filtr DropDownList from another DropDownList

    =?Utf-8?B?SnVhbmpv?=, Dec 23, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,885
    =?Utf-8?B?SnVhbmpv?=
    Dec 23, 2005
  4. =?Utf-8?B?SnVhbmpv?=

    GridView: Filter DropDownList for another DropDownList

    =?Utf-8?B?SnVhbmpv?=, Dec 29, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,316
    =?Utf-8?B?SnVhbmpv?=
    Dec 29, 2005
  5. keithb
    Replies:
    1
    Views:
    12,066
    shauns1
    Nov 1, 2006
Loading...

Share This Page