SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2009
    Posts
    176
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to get value while selecting listitem from the dropdown

    i hav 1 dropdown in that it contains two list item.

    <aspropDownList ID="ddlstatus" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlstatus_SelectedIndexChanged">
    <asp:ListItem>Select</asp:ListItem>
    <asp:ListItem>UnResolved</asp:ListItem>
    <asp:ListItem>Resolved</asp:ListItem>
    </aspropDownList>

    while selecting UnResolved i have to load this method: LoadIncident();

    and while selecting Resolved i have to load this:LoadData();

    so plz can anyone tell me for this which code i hav to write using C#.

  2. #2
    SitePoint Addict kunalraj's Avatar
    Join Date
    Nov 2008
    Posts
    200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi,

    what is this ="ddlstatus_SelectedIndexChanged"?
    I think you have to use javascript for get value from listbox selected item.
    after that you have to take hidden textbox in which you have to set that value which is came from javascript function.

    Now from hidden textbox get value and check if resolve then called your method
    else if unresolved then call ur method......etc.


    any question let me ask,

    thanks,
    kunalraj.

  3. #3
    SitePoint Addict
    Join Date
    Apr 2006
    Posts
    375
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ddlstatus.SelectedValue
    <aspropDownList ID="ddlstatus" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlstatus_SelectedIndexChanged">
    <asp:ListItem Value="">Select</asp:ListItem>
    <asp:ListItem Value="UnResolved">UnResolved</asp:ListItem>
    <asp:ListItem Value="Resolved">Resolved</asp:ListItem>
    </aspropDownList>

  4. #4
    SitePoint Zealot
    Join Date
    Jan 2009
    Posts
    176
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i got the solution.

    Solution is:
    if (ddlstatus.SelectedItem.Text=="UnResolved")
    {
    LoadIncident();
    }
    if (ddlstatus.SelectedItem.Text=="Resolved")
    {
    LoadData();
    }


Bookmarks

Posting Permissions

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