Re: DropDownList - AutoPostBack

Discussion in 'ASP .Net' started by DagoFlores, Feb 17, 2005.

  1. DagoFlores

    DagoFlores Guest

    Hi, it works fine! but what about if some ListBox (by example) are
    inside of a Panel? They dont have the same reaction.

    I have two ListBox webserver controls, one displays a list of elements
    and the second displays the sub-list of the clicked item, if any item
    is clicked.

    Ideas?

    Dago.

    Cowboy (Gregory A. Beamer) wrote:
    > Burt:
    >
    > If you want to use the ASP.NET way of doing things, you have a couple

    of
    > things missing.
    >
    > 1. Autopostback = true - for ASP.NET "server" controls only (I hate

    the
    > server controls name, as HTML controls can run at server too).
    > 2. runat=server
    > 3. Set up a handler (you have done this):
    >
    > Here is a C# example from our app:
    >
    > In ASPX page:
    > <asp:dropdownlist id="ddlCity" runat="server" Width="148px"
    > AutoPostBack="True" />
    >
    > This list is bound in our CodeBehind, but that is not the question.

    Here is
    > the pertinent pieces in the CodeBehind (created by double clicking on

    the
    > drop down):
    >
    > private void ddlCity_SelectedIndexChanged(object sender,

    System.EventArgs e)
    > {
    > // Code here when drop down is changed
    > }
    >
    > private void InitializeComponent()
    > {
    > // This wires the event; I can also do this in the ASPX page
    > this.ddlCity.SelectedIndexChanged += new
    > System.EventHandler(this.ddlCity_SelectedIndexChanged);
    > this.Load += new System.EventHandler(this.Page_Load);
    > }
    >
    > With VB.NET, the routine would be:
    >
    > Private Sub ddlCity_SelectedIndexChanged(sender As Object, e As
    > System.EventArgs ) _
    > Handles ddlCity.SelectedIndexChanged
    >
    > 'Code when drop down is changed
    > End Sub
    >
    >
    > --
    > Gregory A. Beamer
    > MVP; MCP: +I, SE, SD, DBA
    > Author: ADO.NET and XML: ASP.NET on the Edge
    >
    >

    ****************************************************************************
    > ****
    > Think outside the box!
    >

    ****************************************************************************
    > ****
    > "Burt Johnson" <> wrote in message
    > news:031601c2b03a$d3e7a2c0$d2f82ecf@TK2MSFTNGXA09...
    > > I started recreating the whole thing from scratch. When I
    > > run the app from the IDE, I get the error message. This
    > > time I get the following. The "__doPostBack
    > > ('ddlRole','')" is highlighted in yellow.
    > >
    > > More info is always helpful in troubleshooting!!
    > >
    > > Thanx, bdj
    > >
    > > <select name="ddlRole" id="ddlRole" onchange="__doPostBack
    > > ('ddlRole','')" language="javascript"
    > > style="width:152px;Z-INDEX: 101; LEFT: 232px; POSITION:
    > > absolute; TOP: 328px">
    > > <option selected="selected"
    > > value="Employee">Employee</option>
    > > <option value="Freelancer">Freelancer</option>
    > > <option value="Contractor">Contractor</option>
    > > <option value="Consultant">Consultant</option>
    > > <option value="Intern">Intern</option>
    > > <option value="Non-user">Non-user</option>
    > > <option value="Service Account">Service
    > > Account</option>
    > > <option value="Test Account">Test Account</option>
    > >
    > > </select>
    > >
    > >
    > >
    > >
    > >
    > >
    > > >-----Original Message-----
    > > >This sounds like a client side problem. Is there any

    > > difference between the
    > > >rendered HTML on the browser when u use and don't use

    > > forms authentication?
    > > >
    > > >"Burt Johnson" <> wrote in

    > > message
    > > >news:050401c2b023$833a1180$89f82ecf@TK2MSFTNGXA01...
    > > >> I have created a site as per
    > > >> 'How to: Use Forms Authentication with Active

    > > Directory'
    > > >> (http://msdn.microsoft.com/library/en-
    > > >> us/dnnetsec/html/SecNetHT02.asp?frame=true). I can
    > > >> authenticate to Active Directory and get the

    > > default.aspx
    > > >> page. Looks great.
    > > >>
    > > >> This site will be used by our admins to create users
    > > >> within AD. I want to set up a custom validation field
    > > >> that says 'if the user is a non-employee (as defined

    > > in a
    > > >> drop down list) they must have a manager. As I have

    > > read,
    > > >> I must set the drop down list to AutoPostBack=true.

    > > When
    > > >> I do so, I get an error message stating "Microsoft
    > > >> JScript runtime error: Object expected." When I click

    > > the
    > > >> break, I get a box that says "There is no source code
    > > >> available for the current location."
    > > >>
    > > >> If I do the AutoPostBack=true on a page not protected

    > > by
    > > >> the Forms Authentication, it works fine.
    > > >>
    > > >> Anybody have any ideas? No real code at this point

    > > except
    > > >> the aforementioned link and a drop down list
    > > >> with "Employee, Freelancer, Contractor, Consultant,...
    > > >>
    > > >> Thanks in advanced!
    > > >>
    > > >> Burt
    > > >> No Fancy Sig.
    > > >
    > > >
    > > >.
    > > >
    DagoFlores, Feb 17, 2005
    #1
    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. Null
    Replies:
    1
    Views:
    569
    S. Justin Gengo
    Aug 5, 2003
  2. George Durzi
    Replies:
    0
    Views:
    713
    George Durzi
    Aug 15, 2003
  3. S. Justin Gengo
    Replies:
    0
    Views:
    3,123
    S. Justin Gengo
    Aug 15, 2003
  4. Jaleel Syed via .NET 247

    DropDownList (with AutoPostBack) in a DataGrid

    Jaleel Syed via .NET 247, Apr 23, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    501
    Jaleel Syed via .NET 247
    Apr 23, 2004
  5. Daniel Doyle
    Replies:
    1
    Views:
    592
    Steve Caliendo
    Jun 25, 2004
Loading...

Share This Page