Hey Guys,
I have a databound dropdownlist which has the following data items:
Select
Approved
Disapproved

I want that if the user selects "Select" then he should not be allowed to submit it.
Plkease help.

Recommended Answers

All 3 Replies

have u set the autopostback property to true?? clear your question once...

try this code...

in cs file:

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (DropDownList1.SelectedItem.Value == "Select")
        {
            Response.Write("dont do submission");
        }
        else
        {
            Response.Write("do submission");
        }
            
    }

In source here i have taken some items directly u can bound them from db...

<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
            <asp:ListItem>Select</asp:ListItem>
            <asp:ListItem>Approved</asp:ListItem>
            <asp:ListItem>example</asp:ListItem>
        </asp:DropDownList></div>

try it..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.