Drop down list problem

Last post 09-02-2008 12:41 AM by Amipatel1986. 4 replies.

Sort Posts:

  • Drop down list problem

    09-01-2008, 11:27 PM
    • Member
      6 point Member
    • tootia
    • Member since 04-22-2008, 1:37 AM
    • Posts 74

    Hi there

    I have a drop down list in a user defined control,which contains some links. I have used this control on my page.I wrote the selectedIndexchanged handler for it and assigned it to, but I don't knowwhy the handler isn't fired. Could you please give me a hint?

    Thanks in advance. 

    <asp:DropDownList ID="QuickLinkDrp" runat="server" Width="254px" CssClass="quickLink_drp" OnSelectedIndexChanged="drpClick" >

    <asp:ListItem>Mail Registratino</asp:ListItem>

    <asp:ListItem>Help Desk</asp:ListItem>

    </asp:DropDownList>

     

    protected void drpClick(object sender, EventArgs e)

    {

    int quickList_idx = QuickLinkDrp.SelectedIndex;

     

    switch (quickList_idx)

    {

    case 0: Response.Redirect("http://intranet/mail1"); break;

    case 1: Response.Redirect("http://intranet:8080urd"); break;

    }

    }

  • Re: Drop down list problem

    09-02-2008, 12:30 AM
    • Contributor
      2,980 point Contributor
    • santa_1975
    • Member since 06-30-2008, 6:20 AM
    • Posts 496

    I think the event delegate is not properly set. Follow the below steps.

    1) Select the dropdown in design mode and click on properties.

    2) Select the lightning bolt icon on top of the property sheet and click on the "SelectedIndexChanged" event.

    3) Enter the method name "drpClick" you have written in the code behind to handle this event.

    4) Click Save and build the app. Re-run. It should work now.

    Hope this helps.

     

  • Re: Drop down list problem

    09-02-2008, 12:34 AM
    Answer
    • Contributor
      2,297 point Contributor
    • kamrul3d
    • Member since 01-10-2007, 7:09 AM
    • Dhaka, Bangladesh
    • Posts 384

    set autopostback to true

    <asp:DropDownList ID="QuickLinkDrp" runat="server" AutoPostBack="true"  Width="254px" CssClass="quickLink_drp" OnSelectedIndexChanged="drpClick" >

    Thanks,
    Kamrul Hassan

    please mark as answer if it helps u.
  • Re: Drop down list problem

    09-02-2008, 12:40 AM
    • Member
      6 point Member
    • tootia
    • Member since 04-22-2008, 1:37 AM
    • Posts 74

    Oh Thanks heaps! You saved my day. It works fine now!

  • Re: Drop down list problem

    09-02-2008, 12:41 AM
    • Member
      323 point Member
    • Amipatel1986
    • Member since 04-10-2008, 7:59 AM
    • Ahmedabad, India
    • Posts 99

    tootia:

    Hi there

    I have a drop down list in a user defined control,which contains some links. I have used this control on my page.I wrote the selectedIndexchanged handler for it and assigned it to, but I don't knowwhy the handler isn't fired. Could you please give me a hint?

    Thanks in advance. 

    <asp:DropDownList ID="QuickLinkDrp" runat="server" Width="254px" CssClass="quickLink_drp" OnSelectedIndexChanged="drpClick" >

    <asp:ListItem>Mail Registratino</asp:ListItem>

    <asp:ListItem>Help Desk</asp:ListItem>

    </asp:DropDownList>

     

    protected void drpClick(object sender, EventArgs e)

    {

    int quickList_idx = QuickLinkDrp.SelectedIndex;

     

    switch (quickList_idx)

    {

    case 0: Response.Redirect("http://intranet/mail1"); break;

    case 1: Response.Redirect("http://intranet:8080urd"); break;

    }

    }

     

     

    <asp:DropDownList ID="QuickLinkDrp" runat="server" Width="254px" CssClass="quickLink_drp" OnSelectedIndexChanged="drpClick" AutoPostBack="true" >

    <asp:ListItem>Mail Registratino</asp:ListItem>

    <asp:ListItem>Help Desk</asp:ListItem>

    </asp:DropDownList>

    Remember to click "Mark as Answer" on the post that helps U
Page 1 of 1 (5 items)